Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: Testers needed: autodie 1.10 beta released - It's Fatal 2.0!

by pjf (Curate)
on Jul 07, 2008 at 14:11 UTC ( [id://695991]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Testers needed: autodie 1.10 beta released - It's Fatal 2.0!
in thread Testers needed: autodie 1.10 beta released - It's Fatal 2.0!

The most recent autodie distributions on the CPAN should overwhelm your default Fatal.pm upon installation, avoiding any requirement to do odd things with @INC. Do this with caution on a production machine, because while I've taken extreme care to ensure full backwards compatibility with the old Fatal, if things break you'll be keeping both pieces.

As for catching errors from print, unfortunately this isn't supported. At least, not yet. The autodie pragma generates replacements for the core built-ins, and in order to do this it needs to be able to divine their prototypes. Unfortunately, not all of Perl's built-ins have prototypes, the most notable exceptions being system and print.

In the case of system, the exotic form of system { $cmd } @args is so rarely seen that autodie considers it to be an acceptable casualty if you use autodie qw(system), especially since the exotic form is only disabled until the end of the lexical scope where autodie was used.

print, on the other hand, is regularly seen in the form print FILE $data or print {$fh} $data. Since the indirect argument prevents it having a clean prototype, I'd have to break these forms (although only with lexical scope), in order to have an autodying print.

That's not something autodie supports yet, although given that I'd love to have print throw exceptions on error, that will probably change. However anyone wanting to use autodying print would need to ask for it explicitly (it won't be a default behaviour), and be aware that calls to CORE::print (or some other path) will be required if printing to an alternate filehandle is desired (and these won't be autodying).

All the best,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://695991]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-03-29 10:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found