IPC::Run::IO -- I/O channels for IPC::Run. |
IPC::Run::IO -- I/O channels for IPC::Run.
NOT IMPLEMENTED YET ON Win32! Win32 does not allow select() on normal file descriptors; IPC::RUN::IO needs to use IPC::Run::Win32Helper to do this.
use IPC::Run qw( io ) ;
## The sense of '>' and '<' is opposite of perl's open(), ## but agrees with IPC::Run. $io = io( "filename", '>', \$recv ) ; $io = io( "filename", 'r', \$recv ) ;
## Append to $recv: $io = io( "filename", '>>', \$recv ) ; $io = io( "filename", 'ra', \$recv ) ;
$io = io( "filename", '<', \$send ) ; $io = io( "filename", 'w', \$send ) ;
$io = io( "filename", '<<', \$send ) ; $io = io( "filename", 'wa', \$send ) ;
## Handles / IO objects that the caller opens: $io = io( \*HANDLE, '<', \$send ) ;
$f = IO::Handle->new( ... ) ; # Any subclass of IO::Handle $io = io( $f, '<', \$send ) ;
require IPC::Run::IO ; $io = IPC::Run::IO->new( ... ) ;
## Then run(), harness(), or start(): run $io, ... ;
## You can, of course, use io() or IPC::Run::IO->new() as an ## argument to run(), harness, or start(): run io( ... ) ;
This class and module allows filehandles and filenames to be harnessed for I/O when used IPC::Run, independant of anything else IPC::Run is doing (except that errors & exceptions can affect all things that IPC::Run is doing).
INCOMPATIBLE CHANGE: due to the awkwardness introduced in ripping pseudohashes out of Perl, this class no longer uses the fields pragma.
Implement bidirectionality.
Barrie Slaymaker <barries@slaysys.com>
The redirection operators can be a little confusing, so here's a reference table:
> r Read from handle in to process < w Write from process out to handle >> ra Read from handle in to process, appending it to existing data if the destination is a scalar. << wa Write from process out to handle, appending to existing data if IPC::Run::IO opened a named file.
IPC::Run::IO -- I/O channels for IPC::Run. |