diff options
author | Andy Dougherty <doughera.lafayette.edu> | 1995-12-21 00:01:16 +0000 |
---|---|---|
committer | Andy Dougherty <doughera.lafayette.edu> | 1995-12-21 00:01:16 +0000 |
commit | cb1a09d0194fed9b905df7b04a4bc031d354609d (patch) | |
tree | f0c890a5a8f5274873421ac573dfc719188e5eec /lib/IPC | |
parent | 3712091946b37b5feabcc1f630b32639406ad717 (diff) | |
download | perl-cb1a09d0194fed9b905df7b04a4bc031d354609d.tar.gz |
This is patch.2b1g to perl5.002beta1.
cd to your perl source directory, and type
patch -p1 -N < patch.2b1g
This patch is just my packaging of Tom's documentation patches
he released as patch.2b1g.
Patch and enjoy,
Andy Dougherty doughera@lafcol.lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042
Diffstat (limited to 'lib/IPC')
-rw-r--r-- | lib/IPC/Open2.pm | 10 | ||||
-rw-r--r-- | lib/IPC/Open3.pm | 13 |
2 files changed, 14 insertions, 9 deletions
diff --git a/lib/IPC/Open2.pm b/lib/IPC/Open2.pm index 71f89f35c2..1ac963ab6b 100644 --- a/lib/IPC/Open2.pm +++ b/lib/IPC/Open2.pm @@ -10,9 +10,9 @@ IPC::Open2, open2 - open a process for both reading and writing =head1 SYNOPSIS use IPC::Open2; - $pid = open2('rdr', 'wtr', 'some cmd and args'); + $pid = open2(\*RDR, \*WTR, 'some cmd and args'); # or - $pid = open2('rdr', 'wtr', 'some', 'cmd', 'and', 'args'); + $pid = open2(\*RDR, \*WTR, 'some', 'cmd', 'and', 'args'); =head1 DESCRIPTION @@ -39,7 +39,7 @@ however, are quite apt to cause deadlock. The big problem with this approach is that if you don't have control over source code being run in the the child process, you can't control what it does -with pipe buffering. Thus you can't just open a pipe to "cat -v" and continually +with pipe buffering. Thus you can't just open a pipe to C<cat -v> and continually read and write a line from it. =head1 SEE ALSO @@ -80,8 +80,8 @@ sub open2 { # force unqualified filehandles into callers' package local($package) = caller; - $dad_rdr =~ s/^[^']+$/$package'$&/; - $dad_wtr =~ s/^[^']+$/$package'$&/; + $dad_rdr =~ s/^[^']+$/$package'$&/ unless ref $dad_rdr; + $dad_wtr =~ s/^[^']+$/$package'$&/ unless ref $dad_wtr; local($kid_rdr) = ++$fh; local($kid_wtr) = ++$fh; diff --git a/lib/IPC/Open3.pm b/lib/IPC/Open3.pm index db8652ee78..5bc757c344 100644 --- a/lib/IPC/Open3.pm +++ b/lib/IPC/Open3.pm @@ -9,7 +9,7 @@ IPC::Open3, open3 - open a process for reading, writing, and error handling =head1 SYNOPSIS - $pid = open3('WTRFH', 'RDRFH', 'ERRFH' + $pid = open3(\*WTRFH, \*RDRFH, \*ERRFH 'some cmd and args', 'optarg', ...); =head1 DESCRIPTION @@ -24,6 +24,11 @@ the child will read from it directly. If RDRFH or ERRFH begins with ">&", then the child will send output directly to that file handle. In both cases, there will be a dup(2) instead of a pipe(2) made. +If you try to read from the child's stdout writer and their stderr +writer, you'll have problems with blocking, which means you'll +want to use select(), which means you'll have to use sysread() instead +of normal stuff. + All caveats from open2() continue to apply. See L<open2> for details. =cut @@ -78,9 +83,9 @@ sub open3 { # force unqualified filehandles into callers' package my($package) = caller; - $dad_wtr =~ s/^[^:]+$/$package\:\:$&/; - $dad_rdr =~ s/^[^:]+$/$package\:\:$&/; - $dad_err =~ s/^[^:]+$/$package\:\:$&/; + $dad_wtr =~ s/^[^:]+$/$package\:\:$&/ unless ref $dad_wtr; + $dad_rdr =~ s/^[^:]+$/$package\:\:$&/ unless ref $dad_rdr; + $dad_err =~ s/^[^:]+$/$package\:\:$&/ unless ref $dad_err; my($kid_rdr) = ++$fh; my($kid_wtr) = ++$fh; |