Back at home now, I've just tried die('Bail out! Something happened'), but that just does the same as dying with any random string.

print "Bail out! Something happened\n", however, works, with a caveat.

This:

use Test::More tests => 2; ok(1, 'duh'); print "Bail out! Something happened.\n"; ok(2, 'buh');

Results in:

blah.t .. 1/2 Bailout called. Further testing stopped: Something hap +pened. FAILED--Further testing stopped: Something happened.

Which is exactly what I want, but removing the \n in the print 'Bail out! Something happened' statement gives:

blah.t .. 1/2 Bailout called. Further testing stopped: Something hap +pened.ok 2 - buh FAILED--Further testing stopped: Something happened.ok 2 - buh

Which is apparently the harness choking on the bailout message, note the ok 2 - buh there at the end.

I'm trying all this on a recent Perl and Test::More at home, so I'm not sure it'll work on the older Perl at work, but it's worth a try. I'll have to remember to document print 'Bail out! blah' everywhere I use it though, especially since the rest of the code is in French and someday some guy might decide to translate it "properly". Oh well.

Anyway, thanks a lot for taking the time to source dive for some random Anonymous Monk, I appreciate it!


In reply to Re^5: BAIL_OUT with older Test::More by Anonymous Monk
in thread BAIL_OUT with older Test::More by Anonymous Monk

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.