X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FPath.pm;fp=lib%2FCatalyst%2FDispatchType%2FPath.pm;h=66873269994cbff0e14872ad425da37cf1744ead;hp=29c418ffdbad42f7e4afc42a838abb5ed826c75b;hb=391c455f09b823578778b40dce5282890de302d0;hpb=9dac01c784a1f27fe7bb110442d006f9919e9dc1 diff --git a/lib/Catalyst/DispatchType/Path.pm b/lib/Catalyst/DispatchType/Path.pm index 29c418f..6687326 100644 --- a/lib/Catalyst/DispatchType/Path.pm +++ b/lib/Catalyst/DispatchType/Path.pm @@ -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);