I wouldn't call it a change because eval blocks can have return statements in 5.8.8 as well which is where this "issue" (call it what you will) was found. I use returns in eval blocks all the time, in this idiom:

<c>eval { ... something that can die ... #insures we never go into the do block except when we die return 1; } or do { my $e=$@; #the exception ... exception handling here ... };

That odd bit of code is needed because destructors can clear $@ so there are times when a routine dies but $@ is undefined or ''. On the otherhand, an eval block is guarenteed to return undef if it dies an unnatural death. Thus with the above idiom we can be sure that we will enter the do block if and only if the eval block dies before its time.

I would probably add the disappearing exception ($@ being cleared) to my list of odd and hard to track down bugs. It is easy to overlook it as a possiblity unless of course you are "in the know" that such things like disappearing exceptions can happen. Most tutorials on exceptions teach people to capture failure like this eval {...}; if ($@) {...} but if you use that idiom, the exception handling code will never be reached should something wipe out $@.


In reply to Re^6: Wierd bugs I would have never expected by ELISHEVA
in thread Wierd bugs I would have never expected by ELISHEVA

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.