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

Re: autodie.pm design questions

Thread Previous | Thread Next
From:
Roland Giersig
Date:
June 4, 2008 05:28
Subject:
Re: autodie.pm design questions
Message ID:
48468A70.5090408@cpan.org
Paul Fenwick wrote:
> The lack of a prototype on system() means that, should we replace it, 
> the exotic form (only when used in the same package) becomes a syntax 
> error which is generated at compile-time.  To the very best of my 
> knowledge, there's nothing I can possibly do about this without changing 
> perl itself (throwing any sort of backwards portability out the window), 
> or using source-filters (which I think are a very bad idea).
> 
> If I *could* intercept the exotic system, I would, and have it work as 
> expected, and everyone could go and have ice-cream.  As it is, I can 
> only break it.  However the break is obvious, and easily repaired by 
> prefixing it with CORE:: .

Hmm, I understand.  When the parser encounters "use autodie", you switch 
the system() function with your own and parsing continues. But now the 
prototype doesn't match the exotic form, so when the parser encounters 
this, he dies.  With what error message?  Is it possible to intercept 
the message and substitute a better one, so that a "syntax error" or 
"doesn't match prototype" becomes "cannot use exotic system syntax with 
autodie, do blah..."?  I'm not comfortable with perl dieing with a 
syntax error though it is a valid syntax at first glance.  Anyway, my 
feeling is that if you can provide a better error message, then system 
should be :default, else the user should have to explicitely ask for it.

Coming to think of, what does this do:

   use autodie qw(open);
   use autodie qw(system);

Is open still autodieing after the second line? I would hope so.

Servus,

Roland

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