X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FPath.pm;h=66873269994cbff0e14872ad425da37cf1744ead;hb=391c455f09b823578778b40dce5282890de302d0;hp=d58f1fdbe72ab51fdc350dbcf137be9db96c0f00;hpb=ae29b412955743885e80350085167b54b69672da;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/DispatchType/Path.pm b/lib/Catalyst/DispatchType/Path.pm index d58f1fd..6687326 100644 --- a/lib/Catalyst/DispatchType/Path.pm +++ b/lib/Catalyst/DispatchType/Path.pm @@ -22,10 +22,21 @@ Catalyst::DispatchType::Path - Path DispatchType =head1 SYNOPSIS -See L. +See L. =head1 DESCRIPTION +Dispatch type managing full path matching behaviour. For more information on +dispatch types, see: + +=over 4 + +=item * L for how they affect application authors + +=item * L for implementation information. + +=back + =head1 METHODS =head2 $self->list($c) @@ -63,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);