[Catalyst-commits] r10454 - Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Sat Jun 6 10:20:11 GMT 2009


Author: caelum
Date: 2009-06-06 10:20:10 +0000 (Sat, 06 Jun 2009)
New Revision: 10454

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Path.pm
Log:
fix stackoverflow Path bug

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Path.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Path.pm	2009-06-06 10:17:31 UTC (rev 10453)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Path.pm	2009-06-06 10:20:10 UTC (rev 10454)
@@ -74,7 +74,12 @@
 
     $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);




More information about the Catalyst-commits mailing list