Subject: | __DIE__ can be unpredictable |
Verious versions of perl and Test::More set $SIG{__DIE__} differently. This was causing one regression test to fail. This patch fixes that failure
Subject: | Philip_Gwyn-POE-__DIE__01.patch |
diff --git a/lib/POE/Kernel.pm b/lib/POE/Kernel.pm
index a1fb948..32db1d9 100644
--- a/lib/POE/Kernel.pm
+++ b/lib/POE/Kernel.pm
@@ -1057,10 +1057,11 @@ sub _dispatch_event {
# Quiet SIGDIE if it's DEFAULT. If it's something special, then
# someone had better know what they're doing.
+ # 'DEFAULT', undef and '' are all the same
my $old_sig_die = $SIG{__DIE__};
$SIG{__DIE__} = \&_dummy_sigdie_handler if (
- not defined $old_sig_die or $old_sig_die eq 'DEFAULT'
+ not defined $old_sig_die or $old_sig_die eq 'DEFAULT' or $old_sig_die eq ''
);
eval {
diff --git a/t/90_regression/leolo-sig-die.t b/t/90_regression/leolo-sig-die.t
index 648c2b7..4d70f31 100644
--- a/t/90_regression/leolo-sig-die.t
+++ b/t/90_regression/leolo-sig-die.t
@@ -71,7 +71,7 @@ POE::Session->create(
is( $ret, 42, 'scalar_ctx3 return value' );
# Undefine SIGDIE handler to cause a hard death.
- $SIG{__DIE__} = undef;
+ $SIG{__DIE__} = '';
my @ret = $poe_kernel->call( $_[SESSION], 'array_ctx3' );
fail( 'array_ctx3 returned unexpectedly' );
},
@@ -84,7 +84,7 @@ POE::Session->create(
array_ctx3 => sub {
# now we throw an execption up to our __DIE__ handler
- is($SIG{__DIE__}, undef, 'array_ctx3');
+ is($SIG{__DIE__}, '', 'array_ctx3');
$WANT = "array_ctx3";
die "$WANT\nmore\n";
return ( 1..17 );