Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Localize $@ and $SIG{__DIE__} before eval

  • Loading branch information...
commit 6806a8c6dbe5f646512a10243ff230e8db3b1910 1 parent 03f2e10
@autarch authored
Showing with 20 additions and 3 deletions.
  1. +4 −0 Changes
  2. +3 −0  lib/Devel/StackTrace.pm
  3. +13 −3 t/06-dollar-at.t
View
4 Changes
@@ -1,5 +1,9 @@
{{$NEXT}}
+- There was an eval which did not first localize $@ and $SIG{__DIE__}. This
+ broke Plack::Middleware::StackTrace (and possibly other tihngs).
+
+
1.29 2012-11-16
- The Devel::StackTrace->frames() method is now read-write. This allows you to
View
3  lib/Devel/StackTrace.pm
@@ -106,6 +106,9 @@ sub _make_frame_filter {
my ( @i_pack_re, %i_class );
if ( $self->{ignore_package} ) {
+ local $@;
+ local $SIG{__DIE__};
+
$self->{ignore_package} = [ $self->{ignore_package} ]
unless eval { @{ $self->{ignore_package} } };
View
16 t/06-dollar-at.t
@@ -5,10 +5,20 @@ use Test::More;
use Devel::StackTrace;
-$@ = my $msg = "Don't tread on me";
+{
+ $@ = my $msg = q{Don't tread on me};
-Devel::StackTrace->new->frame(0)->as_string;
+ Devel::StackTrace->new()->frame(0)->as_string();
-is( $@, $msg, '$@ is not overwritten in as_string() method' );
+ is( $@, $msg, '$@ is not overwritten in as_string() method' );
+}
+
+{
+ $@ = my $msg = q{Don't tread on me};
+
+ Devel::StackTrace->new( ignore_package => 'Foo' )->frames();
+
+ is( $@, $msg, '$@ is not overwritten in _make_filter() method' );
+}
done_testing();
Please sign in to comment.
Something went wrong with that request. Please try again.