NAME
IPC::ForkPipe - Perl extension for blah blah blah
SYNOPSIS
use IPC::ForkPipe;
use Symbol;
my $pipe = gensym;
my $pid = fork_from_pipe( $pipe );
die "Unable to fork: $!" unless defined $pid;
if( $pid ) { # parent
while( <$pipe> ) {
# handle output from pipe process
}
}
else { # child
print "Hello world\n";
}
# equiv to open("| some-prog" );
my $pipe = gensym;
my $pid = fork_to_pipe( $pipe );
die "Unable to fork: $!" unless defined $pid;
unless( $pid ) { # child
exec "some-prog";
}
print $pipe "Hello world\n";
DESCRIPTION
Win32 does not suport the open(FH,"-|"
and open(FH,"|-"
constructs. This module implements pure-perl functions to do the same thing.
FUNCTIONS
fork_from_pipe
my $pid = fork_from_pipe( $fh );
Equivalent to $pid = open $fh, "-|"
.
fork_to_pipe
my $pid = fork_to_pipe( $fh );
Equivalent to $pid = open $fh, "|-"
.
EXPORT
"fork_to_pipe", "fork_from_pipe".
SEE ALSO
AUTHOR
Philip Gwyn, <gwyn-at-cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2013 by Philip Gwyn
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.