Subject: | perl bug can cause $Test_Died to be incorrectly set |
In Test::Builder (from Test-Simple-0.54), you have a SIG{__DIE__} function which sets $Test_Died, unless the "die" was in the context of an eval.
Unfortunately there is a perl bug that in very specific circumstances causes caller to return erroneous values, which can result in your SIG{__DIE__} not seeing the (eval) frames. A patch has been accepted but obviously this won't make a difference for a while. See http://rt.perl.org/rt3/Ticket/Display.html?id=35059 for more details.
The bug happens if the DB::sub glob exists but the &DB::sub function doesn't; this can occur if the $^P has ever been set to a nonzero value (even if it is later set back to 0). So one workaround would be to (in the signal handler) save a copy of &DB::sub, install a very minimal DB::sub (ie, sub DB::sub { &$sub }), and restore it at the end of the signal handler. I'd just give you a patch, but I'm not sure that this is the best solution.
You can make this issue appear with:
use Test::Builder;
my $Test = Test::Builder->new;
$^P = 16;
eval q(die);
This yields a "# Looks like your test died before it could output anything." even though there was an eval. Under the latest bleadperl (as of my patch today) it does not.