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

Re: [perl #109146] 3-arg open of undef for read

Aristotle Pagaltzis
January 27, 2012 21:51
Re: [perl #109146] 3-arg open of undef for read
Message ID:
* Zefram <> [2012-01-27 12:35]:
> Nicholas Clark wrote:
> >I think that a comprehensive fix should be possible. Note that XS can
> >tell the difference:
> Better to distinguish at compile time.  Literal "undef" is a different
> opcode from "$undefined" or "$hash{typoed_key}".

Does that mean that a wrapper for `open` would have to do this in order
to provide an undef op?

    defined $name ? $name : undef


Or would even that not work because that’s an expression more complex
than a plain `undef`? Ugh.

Please, no.

*AUTOLOAD=*_;sub _{s/$/$"/;s/(.*):://;wantarray//substr$_,-1,1,",$/";print;$1}
#Aristotle Pagaltzis // <> Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About