diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-13 21:11:25 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-13 21:11:25 +0000 |
commit | 21d1ba01f501963c6f61499860ffc70a78ab21c0 (patch) | |
tree | ac0538e88bed305c264bc59c884e6f74d3becef9 /pod/perlopentut.pod | |
parent | a3c98653fde2d5b143dc570697341e3ba7a55108 (diff) | |
download | perl-21d1ba01f501963c6f61499860ffc70a78ab21c0.tar.gz |
Fix an fcntl example in perlopentut, spotted by MJD.
p4raw-id: //depot/perl@22301
Diffstat (limited to 'pod/perlopentut.pod')
-rw-r--r-- | pod/perlopentut.pod | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pod/perlopentut.pod b/pod/perlopentut.pod index 0b60096f24..3116f785c1 100644 --- a/pod/perlopentut.pod +++ b/pod/perlopentut.pod @@ -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, |