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

sartak at bestpractical.com sartak at bestpractical.com
Tue Jul 29 17:22:15 EDT 2008


Author: sartak
Date: Tue Jul 29 17:22:14 2008
New Revision: 14628

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

Log:
 r67923 at onn:  sartak | 2008-07-29 17:22:10 -0400
 Implement aborting the dispatch by die-ing with a special value


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher.pm	Tue Jul 29 17:22:14 2008
@@ -80,12 +80,17 @@
     my $matches = $args{matches};
 
     return sub {
-        for my $match (@$matches) {
-            $self->run_with_number_vars(
-                sub { $match->{rule}->run($path) },
-                @{ $match->{vars} },
-            );
-        }
+        eval {
+            local $SIG{__DIE__} = 'DEFAULT';
+            for my $match (@$matches) {
+                $self->run_with_number_vars(
+                    sub { $match->{rule}->run($path) },
+                    @{ $match->{vars} },
+                );
+            }
+        };
+
+        die $@ if $@ && $@ !~ /^Patch::Dispatcher abort\n/;
     };
 }
 



More information about the Bps-public-commit mailing list