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

sartak at bestpractical.com sartak at bestpractical.com
Sun Oct 19 06:16:46 EDT 2008


Author: sartak
Date: Sun Oct 19 06:16:46 2008
New Revision: 16362

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

Log:
 r74127 at onn:  sartak | 2008-10-19 05:55:54 -0400
 More explicit support for multiple matches from a rule, etc


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher.pm	Sun Oct 19 06:16:46 2008
@@ -62,10 +62,10 @@
     my $self = shift;
     my %args = @_;
 
-    my $match = $args{rule}->match($args{path})
+    my @matches = $args{rule}->match($args{path})
         or return 0;
 
-    $args{dispatch}->add_match($match);
+    $args{dispatch}->add_matches(@matches);
 
     return 1;
 }

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	Sun Oct 19 06:16:46 2008
@@ -17,14 +17,15 @@
     },
 );
 
+# alias add_matches -> add_match
+__PACKAGE__->meta->add_method(add_matches => __PACKAGE__->can('add_match'));
+
 sub add_redispatches {
     my $self       = shift;
     my @dispatches = @_;
 
     for my $dispatch (@dispatches) {
-        for my $match ($dispatch->matches) {
-            $self->add_match($match);
-        }
+        $self->add_matches($dispatch->matches);
     }
 }
 



More information about the Bps-public-commit mailing list