[Bps-public-commit] r15461 - in Path-Dispatcher/trunk: lib/Path/Dispatcher

sartak at bestpractical.com sartak at bestpractical.com
Mon Aug 25 21:29:08 EDT 2008


Author: sartak
Date: Mon Aug 25 21:29:07 2008
New Revision: 15461

Modified:
   Path-Dispatcher/trunk/   (props changed)
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm

Log:
 r70349 at onn:  sartak | 2008-08-25 21:29:04 -0400
 Clean up die handling and expected exceptions (heh).. halve the number of evals we wrap around rule-running code


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm	Mon Aug 25 21:29:07 2008
@@ -52,22 +52,24 @@
     my @args = @_;
     my @matches = $self->matches;
 
-    eval {
-        local $SIG{__DIE__} = 'DEFAULT';
-        while (my $match = shift @matches) {
-            eval {
-                $match->run(@args);
-
-                if ($match->ends_dispatch($self)) {
-                    no warnings 'exiting';
-                    last;
-                }
-            };
-            die $@ if $@ && $@ !~ /^Path::Dispatcher next rule\n/;
-        }
-    };
+    while (my $match = shift @matches) {
+        eval {
+            local $SIG{__DIE__} = 'DEFAULT';
+
+            $match->run(@args);
+
+            if ($match->ends_dispatch($self)) {
+                die "Path::Dispatcher abort\n";
+            }
+        };
+
+        if ($@) {
+            return if $@ =~ /^Path::Dispatcher abort\n/;
+            next if $@ =~ /^Path::Dispatcher next rule\n/;
 
-    die $@ if $@ && $@ !~ /^Path::Dispatcher abort\n/;
+            die $@;
+        }
+    }
 
     return;
 }



More information about the Bps-public-commit mailing list