[ABE.pm] IPC:Run FM?

Ted Fiedler fiedlert at gmail.com
Fri Apr 27 10:44:50 PDT 2007


>From my recollection: I would do something like:

#!/usr/bin/perl

use strict;
use warnings;
use IPC::Run qw( run timeout );

my @command = qw( ls -la );
my ( $buff, $in, $err, $exit );

eval{run \@command, \$in, \$buff};

$exit = ( $@ ) ? 1 : 0;

print $buff if $buff;
print "exit = $exit\n";


Hope that helps.

Ted
On 4/27/07, Faber J. Fedor <faber at linuxnj.com> wrote:
> What's the FM needed to get IPC::Run to work/report errors?  My script
> is this:
>
>     #!/usr/bin/perl -w
>
>     use strict;
>     use IPC::Run qw( run start pump finish timeout ) ;
>
>     my @ssh = qw( ls );
>     my ( $in, $out, $err );
>
>     my $h = start \@ssh, \$in, \$out, \$err ; #, timeout( 10 ) ;
>
>     $in = '/home/faber/';
>
>     pump $h while length $in ; # until $out =~ /ssword:/g ;
>
>     warn $err if $err ;
>     print $out ;
>
>     exit(0);
>
> and whenever I hit the 'pump $h' line, I get a "Command terminated" and
> the debugger quits on me. How am I supposed to debug that?
>
>
>
> --
>
> Regards,
>
> Faber Fedor
> President
> Linux New Jersey, Inc.
> 908-320-0357
> 800-706-0701
>
> http://www.linuxnj.com
>
>
>
> _______________________________________________
> ABE-pm mailing list
> ABE-pm at pm.org
> http://mail.pm.org/mailman/listinfo/abe-pm
>


-- 
"You are never dedicated to something you have complete confidence in.
No one is fanatically shouting that the sun is going to rise tomorrow.
They know it's going to rise tomorrow. "
  -- Robert M Pirsig


More information about the ABE-pm mailing list