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,


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.