develooper Front page | perl.perl5.porters | Postings from February 2012

Re: [perl #37033] open2 oddity with eval "..." and STDIN closed

Thread Previous | Thread Next
From:
David Golden
Date:
February 24, 2012 07:58
Subject:
Re: [perl #37033] open2 oddity with eval "..." and STDIN closed
Message ID:
CAOeq1c-Kd4RHF_LbwXBiruoXE7MoprbUY1Z2exeyv8S4oT5FNQ@mail.gmail.com
On Sun, Jan 8, 2012 at 7:09 PM, Ricardo SIGNES via RT
<perlbug-comment@perl.org> wrote:
>
> tl;dr, some edges are best left explained anew each time

I think the existing documentation could be stronger without getting
into the details, however.

perldata now:

   ...The filehandle is left open pointing to the
   line after __DATA__.  It is the program's responsibility to
   C<close DATA> when it is done reading from it.

Perhaps that could be:

   ...The filehandle is left open pointing to the
   line after __DATA__.  The program should
   C<close DATA> when it is done reading from it.

Leaving it open leaks filehandles if the module is reloaded for any
reason, so it's a safer practice to close it.

I'm not sure if we need to explain why since reloading is pretty rare,
but we could with a single sentence like that if we chose to.

-- David

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