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! |