After sending a hardtime with IPC::Run, I still didn't understand it
from usage example, so I post it here.

In the code below, what [EMAIL PROTECTED], $in, $out, $err? How to declare them?

Question 01:

#http://www.annocpan.org/~RSOD/IPC-Run-0.80/lib/IPC/Run.pm

   ## Using run() instead of system():
      use IPC::Run qw( run timeout ) ;

      run [EMAIL PROTECTED], \$in, \$out, \$err, timeout( 10 ) or die "cat: $?"

      # Can do I/O to sub refs and filenames, too:
      run [EMAIL PROTECTED], '<', "in.txt", \&out, \&err or die "cat: $?"
      run [EMAIL PROTECTED], '<', "in.txt", '>>', "out.txt", '2>>', "err.txt" ;

      # Redirecting using psuedo-terminals instad of pipes.
      run [EMAIL PROTECTED], '<pty<', \$in,  '>pty>', \$out_and_err ;


Question 02:

The following code using IPC::open3 ( works fine under Perl 5.5.6,
mod_perl 1.3, Apache 1.3.x ) to run and command.
How does it look like if I port it to IPC::Run ( under Perl 5.5.8,
mod_perl 2.0.3, Apache 2.0.52 )
# IPC::open3 is no longer available under the new environment.

my $OUT = new FileHandle;
my $IN = new FileHandle;
my $ERR = new FileHandle;

my $tie_stdin = tied *STDIN;
my $tie_stdout = tied *STDOUT;
my $tie_done = undef;
untie *STDIN if $tie_stdin;
untie *STDOUT if $tie_stdout;
my $pid;

#eval { $pid = open3( $OUT, $IN, $ERR, "/path/to/cmd $paramx" ) };

Reply via email to