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

sartak at bestpractical.com sartak at bestpractical.com
Wed Oct 29 21:01:02 EDT 2008


Author: sartak
Date: Wed Oct 29 21:01:02 2008
New Revision: 16615

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

Log:
 r74843 at onn:  sartak | 2008-10-29 21:00:56 -0400
 Each match gets a scalar result


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	Wed Oct 29 21:01:02 2008
@@ -24,26 +24,28 @@
     my $self = shift;
     my @args = @_;
     my @matches = $self->matches;
+    my @results;
 
     while (my $match = shift @matches) {
         eval {
             local $SIG{__DIE__} = 'DEFAULT';
 
-            $match->run(@args);
+            push @results, scalar $match->run(@args);
 
             die "Path::Dispatcher abort\n"
                 if $match->ends_dispatch($self);
         };
 
         if ($@) {
-            return if $@ =~ /^Path::Dispatcher abort\n/;
+            last if $@ =~ /^Path::Dispatcher abort\n/;
             next if $@ =~ /^Path::Dispatcher next rule\n/;
 
             die $@;
         }
     }
 
-    return;
+    return @results if wantarray;
+    return $results[0];
 }
 
 __PACKAGE__->meta->make_immutable;



More information about the Bps-public-commit mailing list