develooper Front page | perl.perl5.porters | Postings from January 2011

Re: [perl #82802] [PATCH] fileno should return undef when PerlIOreturns -1

Thread Previous | Thread Next
From:
Steve Peters
Date:
January 26, 2011 06:31
Subject:
Re: [perl #82802] [PATCH] fileno should return undef when PerlIOreturns -1
Message ID:
AANLkTim-KCUHZXEeHNEeqpLnhBAe6Z8PB_ckFBGTqC00@mail.gmail.com
On Wed, Jan 26, 2011 at 8:23 AM, Leon Timmermans <fawaka@gmail.com> wrote:

> On Wed, Jan 26, 2011 at 11:21 AM, Bo Lindbergh <blgl@stacken.kth.se>
> wrote:
> > s/fixes/breaks/;
> >
> > A return value of -1 from a fileno method is not an error indicator;
> > it means that there's no operating system file descriptor
> > at the bottom of the layer stack (e.g. PerlIO::Scalar).
> >
> > The current behaviour of pp_fileno is correct since defined(fileno(FOO))
> > is the canonical way of testing whether a filehandle is open.
>
> The documentation of fileno explicitly disagrees: «Filehandles
> connected to memory objects via new features of "open" may return
> undefined even though they are open.» It has been in there for 10
> years (b76cc8ba).
>
> There is a way to check if a filehandle is open, it just hasn't ever
> been documented and it is rather obscure (welcome to PerlIO): that's a
> good reason to abstract it in openhandle. Overloading fileno with this
> never was a good idea IMO.
>
> Leon
>

So is the obscure method for checking if a filehandle is open now
documented?

Steve


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About