From: Rafael Garcia-Suarez Date: Fri, 13 Feb 2004 21:11:25 +0000 (+0000) Subject: Fix an fcntl example in perlopentut, spotted by MJD. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21d1ba01f501963c6f61499860ffc70a78ab21c0;p=p5sagit%2Fp5-mst-13.2.git Fix an fcntl example in perlopentut, spotted by MJD. p4raw-id: //depot/perl@22301 --- diff --git a/pod/perlopentut.pod b/pod/perlopentut.pod index 0b60096..3116f78 100644 --- a/pod/perlopentut.pod +++ b/pod/perlopentut.pod @@ -723,7 +723,9 @@ With descriptors that you haven't opened using C, such as sockets, you can set them to be non-blocking using C: 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 Cs,