I'm not asking for a solution this time (because I've solved the problem), but for an explanation - I would like to know why my solution worked. This was the original problem:

We had some code which basically looked like this:

# This is file P.pm package P; use strict; use warnings; use PX; .... eval { PX::myfunc(...); }; if($@) { print "Exception!\n"; } .... # This is file PX.pm package PX; use strict; use warnings; sub myfunc { ... print("let's do it\n"); foreach my $c (@{ $foo->{bar}->{baz} }) { oink_oink_oink(); } print "I've done it\n"; }
Due to a mistake, $foo was set up in a way that the expression in the foreach produced a "Pseudo Hash Deprecated" error. I would have expected to see the output
let's do it Exception!
but instead I was seeing
let's do it Pseudo hashes are deprecated at....
and the program terminated. I solved this by changing PX.pm so that the warnings Pragma in PX.pm reads
use warnings FATAL => qw(all);
I saw the expected output. This puzzles me for two reason:

First, I understand that using a pseudo hash results in a run-time error, which means an exception should be generated. Since the calling program uses eval, the exception should have been caught here.

Second, the modified pragma just means that "warnings are turned into an exception". Since "Pseudo hashes are deprecated" is not a warning (after all, the program aborted afterwards), it should not be affected by warnings FATAL=>'all'. Could someone enlighten me here? This was run on ActiveState Perl 5.8.8.

-- 
Ronald Fischer <ynnor@mm.st>

In reply to use warnings; and deprecated Pseudo hashes by rovf

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.