This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix an fcntl example in perlopentut, spotted by MJD.
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 13 Feb 2004 21:11:25 +0000 (21:11 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Fri, 13 Feb 2004 21:11:25 +0000 (21:11 +0000)
p4raw-id: //depot/perl@22301

pod/perlopentut.pod

index 0b60096..3116f78 100644 (file)
@@ -723,7 +723,9 @@ With descriptors that you haven't opened using C<sysopen>, such as
 sockets, you can set them to be non-blocking using C<fcntl>:
 
     use Fcntl;
-    fcntl(Connection, F_SETFL, O_NONBLOCK) 
+    my $old_flags = fcntl($handle, F_GETFL, 0) 
+        or die "can't get flags: $!";
+    fcntl($handle, F_SETFL, $old_flags | O_NONBLOCK) 
         or die "can't set non blocking: $!";
 
 Rather than losing yourself in a morass of twisting, turning C<ioctl>s,