X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FChained.pm;h=1d7783b499cb33c66b72cd8fb414bb854e60dd91;hp=32b2c3b24dce3fdb2d292049cb49b3d41e6173ca;hb=8a6a6581d48a3c1c4d5f631cdb7cbda336c0e5e2;hpb=1c34f703cbd82cddceea95593001a579e1d5f646 diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 32b2c3b..1d7783b 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -115,8 +115,9 @@ sub recurse_match { my $children = $self->{children_of}{$parent}; return () unless $children; my @captures; - TRY: foreach my $try_part (sort { length($a) <=> length($b) } + TRY: foreach my $try_part (sort { length($b) <=> length($a) } keys %$children) { + # $b then $a to try longest part first my @parts = @$path_parts; if (length $try_part) { # test and strip PathPart next TRY unless @@ -201,6 +202,12 @@ sub register { ); } + if ($part =~ m(^/)) { + Catalyst::Exception->throw( + "Absolute parameters to PathPart not allowed registering ${action}" + ); + } + $action->attributes->{PartPath} = [ $part ]; unshift(@{ $children->{$part} ||= [] }, $action);