LogoopenSUSE Build Service > Projects
Sign Up | Log In

IPC::Run3 - run a subprocess with input/ouput redirection

This module allows you to run a subprocess and redirect stdin, stdout, and/or stderr to files and perl data structures. It aims to satisfy 99% of the need for using system, qx, and open3 with a simple, extremely Perlish API.

Speed, simplicity, and portability are paramount. (That's speed of Perl code; which is often much slower than the kind of buffered I/O that this module uses to spool input to and output from the child command.)
run3($cmd, $stdin, $stdout, $stderr, \%options)

All parameters after $cmd are optional.

The parameters $stdin, $stdout and $stderr indicate how the child's corresponding filehandle (STDIN, STDOUT and STDERR, resp.) will be redirected. Because the redirects come last, this allows STDOUT and STDERR to default to the parent's by just not specifying them -- a common use case.

run3 throws an exception if the wrapped system call returned -1 or anything went wrong with run3's processing of filehandles. Otherwise it returns true. It leaves $? intact for inspection of exit and wait status.

Note that a true return value from run3 doesn't mean that the command had a successful exit code. Hence you should always check $?.

See "%options" for an option to handle the case of system returning -1 yourself.
$cmd

Source Files

Filename Size Changed Actions
IPC-Run3-0.042.tar.gz 18.8 KB about 9 years ago Download File
perl-IPC-Run3.spec 2.53 KB about 9 years ago Download File

Comments for home:csbuild:Perl (0)