move the big AVAILABILITY list to perlport as Supported Platforms
[p5sagit/p5-mst-13.2.git] / pod / perlipc.pod
index 2f99d10..a9c7e48 100644 (file)
@@ -58,7 +58,7 @@ You may also choose to assign the strings C<'IGNORE'> or C<'DEFAULT'> as
 the handler, in which case Perl will try to discard the signal or do the
 default thing.
 
-On most UNIX platforms, the C<CHLD> (sometimes also known as C<CLD>) signal
+On most Unix platforms, the C<CHLD> (sometimes also known as C<CLD>) signal
 has special behavior with respect to a value of C<'IGNORE'>.
 Setting C<$SIG{CHLD}> to C<'IGNORE'> on such a platform has the effect of
 not creating zombie processes when the parent process fails to C<wait()>
@@ -126,7 +126,7 @@ or even the more elaborate:
     use POSIX ":sys_wait_h";
     sub REAPER {
        my $child;
-        while ($child = waitpid(-1,WNOHANG)) {
+        while (($child = waitpid(-1,WNOHANG)) > 0) {
            $Kid_Status{$child} = $?;
        }
        $SIG{CHLD} = \&REAPER;  # still loathe sysV
@@ -152,6 +152,10 @@ Here's an example:
     };
     if ($@ and $@ !~ /alarm clock restart/) { die }
 
+If the operation being timed out is system() or qx(), this technique
+is liable to generate zombies.    If this matters to you, you'll
+need to do your own fork() and exec(), and kill the errant child process.
+
 For more complex signal handling, you might see the standard POSIX
 module.  Lamentably, this is almost entirely undocumented, but
 the F<t/lib/posix.t> file from the Perl source distribution has some
@@ -276,7 +280,7 @@ same effect as opening a pipe for reading:
 
 While this is true on the surface, it's much more efficient to process the
 file one line or record at a time because then you don't have to read the
-whole thing into memory at once. It also gives you finer control of the
+whole thing into memory at once.  It also gives you finer control of the
 whole process, letting you to kill off the child process early if you'd
 like.
 
@@ -307,8 +311,7 @@ To catch it, you could use this:
 
 Both the main process and any child processes it forks share the same
 STDIN, STDOUT, and STDERR filehandles.  If both processes try to access
-them at once, strange things can happen.  You'll certainly want to any
-stdio flush output buffers before forking.  You may also want to close
+them at once, strange things can happen.  You may also want to close
 or reopen the filehandles for the child.  You can get around this by
 opening your pipe with open(), but on some systems this means that the
 child process cannot outlive the parent.
@@ -450,8 +453,8 @@ doesn't actually work:
 
     open(PROG_FOR_READING_AND_WRITING, "| some program |")
 
-and if you forget to use the B<-w> flag, then you'll miss out
-entirely on the diagnostic message:
+and if you forget to use the C<use warnings> pragma or the B<-w> flag,
+then you'll miss out entirely on the diagnostic message:
 
     Can't do bidirectional pipe at -e line 1.
 
@@ -473,7 +476,6 @@ Here's an example of using open2():
     use FileHandle;
     use IPC::Open2;
     $pid = open2(*Reader, *Writer, "cat -u -n" );
-    Writer->autoflush(); # default here, actually
     print Writer "stuff\n";
     $got = <Reader>;
 
@@ -1022,7 +1024,7 @@ something to the server before fetching the server's response.
 The web server handing the "http" service, which is assumed to be at
 its standard port, number 80.  If your the web server you're trying to
 connect to is at a different port (like 1080 or 8080), you should specify
-as the named-parameter pair, C<PeerPort =E<gt> 8080>.  The C<autoflush>
+as the named-parameter pair, C<< PeerPort => 8080 >>.  The C<autoflush>
 method is used on the socket because otherwise the system would buffer
 up the output we sent it.  (If you're on a Mac, you'll also need to
 change every C<"\n"> in your code that sends data over the network to
@@ -1140,7 +1142,7 @@ well.
 As always, setting up a server is little bit more involved than running a client.
 The model is that the server creates a special kind of socket that
 does nothing but listen on a particular port for incoming connections.
-It does this by calling the C<IO::Socket::INET-E<gt>new()> method with
+It does this by calling the C<< IO::Socket::INET->new() >> method with
 slightly different arguments than the client did.
 
 =over
@@ -1159,7 +1161,7 @@ server. (Under Unix, ports under 1024 are restricted to the
 superuser.)  In our sample, we'll use port 9000, but you can use
 any port that's not currently in use on your system.  If you try
 to use one already in used, you'll get an "Address already in use"
-message. Under Unix, the C<netstat -a> command will show
+message.  Under Unix, the C<netstat -a> command will show
 which services current have servers.
 
 =item Listen