[Catalyst-commits] r13571 - Catalyst-Runtime/5.80/branches/safer_eval/lib

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Wed Sep 1 21:03:36 GMT 2010


Author: t0m
Date: 2010-09-01 22:03:36 +0100 (Wed, 01 Sep 2010)
New Revision: 13571

Modified:
   Catalyst-Runtime/5.80/branches/safer_eval/lib/Catalyst.pm
Log:
Do the right thing more with the eval around action execution

Modified: Catalyst-Runtime/5.80/branches/safer_eval/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/safer_eval/lib/Catalyst.pm	2010-09-01 21:01:04 UTC (rev 13570)
+++ Catalyst-Runtime/5.80/branches/safer_eval/lib/Catalyst.pm	2010-09-01 21:03:36 UTC (rev 13571)
@@ -1642,13 +1642,18 @@
     push( @{ $c->stack }, $code );
 
     no warnings 'recursion';
-    eval { $c->state( $code->execute( $class, $c, @{ $c->req->args } ) || 0 ) };
+    my ($error, $failed);
+    {
+        local $@;
+        $failed = not eval { $c->state( $code->execute( $class, $c, @{ $c->req->args } ) || 0 ); 1; };
+        $error = $@;
+    }
 
     $c->_stats_finish_execute( $stats_info ) if $c->use_stats and $stats_info;
 
     my $last = pop( @{ $c->stack } );
 
-    if ( my $error = $@ ) {
+    if ( $failed ) {
         if ( blessed($error) and $error->isa('Catalyst::Exception::Detach') ) {
             $error->rethrow if $c->depth > 1;
         }
@@ -1658,6 +1663,7 @@
         else {
             unless ( ref $error ) {
                 no warnings 'uninitialized';
+                $error = 'undef' unless defined $error;
                 chomp $error;
                 my $class = $last->class;
                 my $name  = $last->name;




More information about the Catalyst-commits mailing list