Permalink
Browse files

Localize $SIG{__DIE__} when rethrowing userspace exceptions from a sa…

…fe point. Avoids shenanigans at a distance when reporting on userspace errors. May thwart someone's exception handling, but I don't know a good way to satisfy everyone here. Suggestions?
  • Loading branch information...
1 parent 9a8c4a3 commit f0eff5d176cd9e5522bd8d2d2461396f704f2429 @rcaputo committed May 18, 2011
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/POE/Kernel.pm
View
@@ -1009,7 +1009,11 @@ sub _dispatch_event {
my $return;
my $wantarray = wantarray();
-confess unless defined $session;
+
+ confess 'please report this stacktrace to bug-poe@rt.cpan.org' unless (
+ defined $session
+ );
+
if ($type & (ET_CALL | ET_START | ET_STOP)) {
eval {
if ($wantarray) {
@@ -1076,7 +1080,11 @@ confess unless defined $session;
}
}
else {
- die "$@\n" if ref($@) or $@ ne '';
+ if (ref($@) or $@ ne '') {
+ # Avoid shenanigans at a distance.
+ local $SIG{__DIE__};
+ die "$@\n";
+ }
}
# Call with exception catching.

0 comments on commit f0eff5d

Please sign in to comment.