What your module code definitely shouldn't be doing is the unfortunately common but wrong idiom eval {...}; if ($@) {handle_error} - instead, you should do something like eval { ...; 1 } or handle_error;. If you're doing the former in your module, then you need to change the module code.

That gives you reliable detection of errors, and other than that, you could customize your tests to not check the contents of $@ pre-5.14. (Also, I seem to remember some long-standing issues with $SIG{__DIE__} inside of evals, so be careful with that too. And also IIRC even post-5.14 some smaller issues with $@ remained, so to say that $@ now works perfectly isn't quite correct either. Lazy Sunday, so I don't have the references for both issues handy at the moment...)


In reply to Re: Testing a module with eval() where $@ is clobbered (pre v5.14) by Anonymous Monk
in thread Testing a module with eval() where $@ is clobbered (pre v5.14) by stevieb

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.