diff options
author | Shlomi Fish <shlomif@shlomifish.org> | 2014-10-16 12:25:30 +0300 |
---|---|---|
committer | James E Keenan <jkeenan@cpan.org> | 2014-12-03 21:10:37 -0500 |
commit | e6ebbe921e63dbd445aa30e30a0b2b80574b88a0 (patch) | |
tree | b2284859c013464f3451fa12243e60e6a7c2ad8b | |
parent | 0e3be540c5c5d8ec7d6c682091855e8865b99b51 (diff) | |
download | perl-e6ebbe921e63dbd445aa30e30a0b2b80574b88a0.tar.gz |
perlfork.pod: convert "\t"s to spaces.
For: RT #122987 (second part)
-rw-r--r-- | pod/perlfork.pod | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/pod/perlfork.pod b/pod/perlfork.pod index 172add56a2..c118fb51b4 100644 --- a/pod/perlfork.pod +++ b/pod/perlfork.pod @@ -168,8 +168,8 @@ BEGIN block, but will not continue parsing the source stream after the BEGIN block. For example, consider the following code: BEGIN { - fork and exit; # fork child and exit the parent - print "inner\n"; + fork and exit; # fork child and exit the parent + print "inner\n"; } print "outer\n"; @@ -224,58 +224,58 @@ write to a forked child: # simulate open(FOO, "|-") sub pipe_to_fork ($) { - my $parent = shift; - pipe my $child, $parent or die; - my $pid = fork(); - die "fork() failed: $!" unless defined $pid; - if ($pid) { - close $child; - } - else { - close $parent; - open(STDIN, "<&=" . fileno($child)) or die; - } - $pid; + my $parent = shift; + pipe my $child, $parent or die; + my $pid = fork(); + die "fork() failed: $!" unless defined $pid; + if ($pid) { + close $child; + } + else { + close $parent; + open(STDIN, "<&=" . fileno($child)) or die; + } + $pid; } if (pipe_to_fork('FOO')) { - # parent - print FOO "pipe_to_fork\n"; - close FOO; + # parent + print FOO "pipe_to_fork\n"; + close FOO; } else { - # child - while (<STDIN>) { print; } - exit(0); + # child + while (<STDIN>) { print; } + exit(0); } And this one reads from the child: # simulate open(FOO, "-|") sub pipe_from_fork ($) { - my $parent = shift; - pipe $parent, my $child or die; - my $pid = fork(); - die "fork() failed: $!" unless defined $pid; - if ($pid) { - close $child; - } - else { - close $parent; - open(STDOUT, ">&=" . fileno($child)) or die; - } - $pid; + my $parent = shift; + pipe $parent, my $child or die; + my $pid = fork(); + die "fork() failed: $!" unless defined $pid; + if ($pid) { + close $child; + } + else { + close $parent; + open(STDOUT, ">&=" . fileno($child)) or die; + } + $pid; } if (pipe_from_fork('BAR')) { - # parent - while (<BAR>) { print; } - close BAR; + # parent + while (<BAR>) { print; } + close BAR; } else { - # child - print "pipe_from_fork\n"; - exit(0); + # child + print "pipe_from_fork\n"; + exit(0); } Forking pipe open() constructs will be supported in future. |