fix stackoverflow Path bug
Rafael Kitover [Sat, 6 Jun 2009 10:20:10 +0000 (10:20 +0000)]
lib/Catalyst/DispatchType/Path.pm

index 29c418f..6687326 100644 (file)
@@ -74,7 +74,12 @@ sub match {
 
     $path = '/' if !defined $path || !length $path;
 
-    foreach my $action ( @{ $self->_paths->{$path} || [] } ) {
+    # sort from least args to most
+    my @actions = sort { ($b->attributes->{Args}||0) <=>
+                      ($a->attributes->{Args}||0) }
+            @{ $self->_paths->{$path} || [] };
+
+    foreach my $action ( @actions ) {
         next unless $action->match($c);
         $c->req->action($path);
         $c->req->match($path);