Otherwise, you will trigger all SIGDIE handlers and, not surprisingly, Test::More has one.Test::Builder, actually. To whit:
I'm afraid that eval{} users have to be allowed the ease-of-coding advantage over die-handlers. The whole purpose of eval is to catch an exception; you shouldn't have to go through additional hoops to protect against an exception. Yes, there's a perl design botch, but eval{} shouldn't have to suffer for it. (As far as I know, $^S is working in newer perls, which should make things a little easier.)$SIG{__DIE__} = sub { # We don't want to muck with death in an eval, but $^S isn't # totally reliable. 5.005_03 and 5.6.1 both do the wrong thing # with it. Instead, we use caller. This also means it runs under # 5.004! my $in_eval = 0; for( my $stack = 1; my $sub = (CORE::caller($stack))[3]; $stack+ ++ ) { $in_eval = 1 if $sub =~ /^\(eval\)/; } $Test_Died = 1 unless $in_eval; };
In reply to Re^2: Overloading ref() just like ->isa and ->can?
by ysth
in thread Overloading ref() just like ->isa and ->can?
by diotalevi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |