In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/3231d2579ce5888f1afc6ca0c6c50ca2d7826e54?hp=cbcb2a16c528e483a6c8804d2d2daefecc1a0d3e>
- Log ----------------------------------------------------------------- commit 3231d2579ce5888f1afc6ca0c6c50ca2d7826e54 Author: Dominic Hargreaves <[email protected]> Date: Sun Jun 9 01:28:50 2013 +0100 Improve fileno example Quoting from the fileno section of this document: "[...] If there is no real file descriptor at the OS level, as can happen with filehandles connected to memory objects via "open" with a reference for the third argument, -1 is returned." Update the example to cater for this situation. Thanks to Niels Thykier for the suggestion. Bug-Debian: http://bugs.debian.org/706749 ----------------------------------------------------------------------- Summary of changes: pod/perlfunc.pod | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 9ad4793..d386245 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2260,8 +2260,12 @@ filehandle, generally its name. You can use this to find out whether two handles refer to the same underlying descriptor: - if (fileno(THIS) == fileno(THAT)) { + if (fileno(THIS) != -1 && fileno(THIS) == fileno(THAT)) { print "THIS and THAT are dups\n"; + } elsif (fileno(THIS) != -1 && fileno(THAT) != -1) { + print "THIS and THAT have different underlying file descriptors\n"; + } else { + print "At least one of THIS and THAT does not have a real file descriptor\n"; } =item flock FILEHANDLE,OPERATION -- Perl5 Master Repository
