From: perl-5.8.0@ton.iguana.be Date: Tue, 28 Oct 2003 13:37:49 +0000 (+0000) Subject: Move a fcntl() example in perlfunc at a more proper place, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=be2f7487fc96cdcf159c9733c5c0dcd982e12af0;p=p5sagit%2Fp5-mst-13.2.git Move a fcntl() example in perlfunc at a more proper place, as suggested by : Subject: [perl #24334] ioctl/fcntl doc confusion From: "perl-5.8.0@ton.iguana.be (via RT)" Message-ID: p4raw-id: //depot/perl@21575 --- diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 6b093eb..7879e34 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1654,6 +1654,18 @@ Note that C will produce a fatal error if used on a machine that doesn't implement fcntl(2). See the Fcntl module or your fcntl(2) manpage to learn what functions are available on your system. +Here's an example of setting a filehandle named C to be +non-blocking at the system level. You'll have to negotiate C<$|> +on your own, though. + + use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); + + $flags = fcntl(REMOTE, F_GETFL, 0) + or die "Can't get flags for the socket: $!\n"; + + $flags = fcntl(REMOTE, F_SETFL, $flags | O_NONBLOCK) + or die "Can't set flags for the socket: $!\n"; + =item fileno FILEHANDLE Returns the file descriptor for a filehandle, or undefined if the @@ -2286,21 +2298,9 @@ system: $retval = ioctl(...) || -1; printf "System returned %d\n", $retval; -The special string "C<0> but true" is exempt from B<-w> complaints +The special string C<"0 but true"> is exempt from B<-w> complaints about improper numeric conversions. -Here's an example of setting a filehandle named C to be -non-blocking at the system level. You'll have to negotiate C<$|> -on your own, though. - - use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); - - $flags = fcntl(REMOTE, F_GETFL, 0) - or die "Can't get flags for the socket: $!\n"; - - $flags = fcntl(REMOTE, F_SETFL, $flags | O_NONBLOCK) - or die "Can't set flags for the socket: $!\n"; - =item join EXPR,LIST Joins the separate strings of LIST into a single string with fields