develooper Front page | perl.perl5.porters | Postings from June 2013

perl needs safer implicit close

Thread Next
From:
Ricardo Signes
Date:
June 11, 2013 22:30
Subject:
perl needs safer implicit close
Message ID:
20130611223014.GA11504@cancer.codesimply.com

I promised that I'd write up the things that I think Perl most needs as
clear-cut changes that will still significantly improve working in Perl.  This
is the first thing I'm posting along those lines:

This is one of the things I would most like to see addressed in the next stable
release of perl.  We've got a five year old ticket about it.  I will decline to
speculate what that says about it getting done:

  https://rt.perl.org/rt3/Ticket/Display.html?id=57512

Tom's description there is, to nobody's surprise, thorough and on point.

Basically:  autovivified filehandles in lexical variables feel a *lot* easier
to use, and avoid package variables, which we try to discourage elsewhere for
various reasons.  The problem is that the list of reasons to use them sometimes
includes, "and you don't have to account for closing them, because they close
when the reference is destroyed!"  Yeah, they close, and the error status is
lost forever, like tears in rain.

We should issue a warning when an implicit close results in error.  autodie.pm
can then fatalize that warning.  We should also fatalize errors on the implicit
close of the selected fh at END, to deal with errors during -i, for example.

-- 
rjbs


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