[Catalyst-commits] r8344 - in trunk/Catalyst-Plugin-StackTrace: . lib/Catalyst/Plugin

ilmari at dev.catalyst.perl.org ilmari at dev.catalyst.perl.org
Wed Sep 3 11:48:27 BST 2008


Author: ilmari
Date: 2008-09-03 11:48:27 +0100 (Wed, 03 Sep 2008)
New Revision: 8344

Modified:
   trunk/Catalyst-Plugin-StackTrace/Changes
   trunk/Catalyst-Plugin-StackTrace/lib/Catalyst/Plugin/StackTrace.pm
Log:
- Filter out unwanted stack frames and attributes in the
  $SIG{__DIE__} handler instead of finalize_error().
- Avoid stringifying refs in the trace, since we now throw them
  away immediately.


Modified: trunk/Catalyst-Plugin-StackTrace/Changes
===================================================================
--- trunk/Catalyst-Plugin-StackTrace/Changes	2008-09-03 08:59:03 UTC (rev 8343)
+++ trunk/Catalyst-Plugin-StackTrace/Changes	2008-09-03 10:48:27 UTC (rev 8344)
@@ -1,5 +1,11 @@
 Revision history for Perl extension Catalyst::Plugin::StackTrace
 
+0.09
+        - Filter out unwanted stack frames and attributes in the
+          $SIG{__DIE__} handler instead of finalize_error().
+        - Avoid stringifying refs in the trace, since we now throw them
+          away immediately.
+
 0.08    2008-04-04 16:30:00
         - Allow enabling functionality by config variable
 

Modified: trunk/Catalyst-Plugin-StackTrace/lib/Catalyst/Plugin/StackTrace.pm
===================================================================
--- trunk/Catalyst-Plugin-StackTrace/lib/Catalyst/Plugin/StackTrace.pm	2008-09-03 08:59:03 UTC (rev 8343)
+++ trunk/Catalyst-Plugin-StackTrace/lib/Catalyst/Plugin/StackTrace.pm	2008-09-03 10:48:27 UTC (rev 8344)
@@ -64,8 +64,6 @@
                 $trace = Devel::StackTrace->new(
                     ignore_package   => $ignore_package,
                     ignore_class     => $ignore_class,
-                    no_refs          => 1,
-                    respect_overload => 1,
                 );
             };
         }
@@ -74,8 +72,23 @@
         my @frames = $c->config->{stacktrace}->{reverse} ?
         reverse $trace->frames : $trace->frames;
 
-        $c->_stacktrace( [@frames] );
+        my $keep_frames = [];
+        for my $frame ( @frames ) {
+            # only display frames from the user's app unless verbose
+            if ( !$c->config->{stacktrace}->{verbose} ) {
+                my $app = "$c";
+                $app =~ s/=.*//;
+                next unless $frame->package =~ /^$app/;
+            }
 
+            push @{$keep_frames}, {
+                pkg  => $frame->package,
+                file => $frame->filename,
+                line => $frame->line,
+            };
+        }
+        $c->_stacktrace( $keep_frames );
+
         die $error;
     };
 
@@ -90,22 +103,6 @@
     if ( $c->debug ) {
         return unless ref $c->_stacktrace eq 'ARRAY';
 
-        my $trace = [];
-        for my $frame ( @{ $c->_stacktrace } ) {
-            # only display frames from the user's app unless verbose
-            if ( !$c->config->{stacktrace}->{verbose} ) {
-                my $app = "$c";
-                $app =~ s/=.*//;
-                next unless $frame->package =~ /^$app/;
-            }
-
-            push @{$trace}, {
-                pkg  => $frame->package,
-                file => $frame->filename,
-                line => $frame->line,
-            };
-        }
-
         # insert the stack trace into the error screen above the "infos" div
         my $html = qq{
             <style type="text/css">
@@ -135,7 +132,7 @@
                            <th>File   </th>
                        </tr>
         };
-        for my $frame ( @{$trace} ) {
+        for my $frame ( @{$c->_stacktrace} ) {
 
             # clean up the common filename of
             # .../MyApp/script/../lib/...




More information about the Catalyst-commits mailing list