my $parent = "DUMMY";
my $curr = $endpoint;
while ($curr) {
- if (my $cap = $curr->attributes->{Captures}) {
+ if (my $cap = $curr->attributes->{CaptureArgs}) {
unshift(@parts, (("*") x $cap->[0]));
}
if (my $pp = $curr->attributes->{PartPath}) {
my @rows;
foreach my $p (@parents) {
my $name = "/${p}";
- if (my $cap = $p->attributes->{Captures}) {
+ if (my $cap = $p->attributes->{CaptureArgs}) {
$name .= ' ('.$cap->[0].')';
}
unless ($p eq $parents[0]) {
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
}
my @try_actions = @{$children->{$try_part}};
TRY_ACTION: foreach my $action (@try_actions) {
- if (my $capture_attr = $action->attributes->{Captures}) {
+ if (my $capture_attr = $action->attributes->{CaptureArgs}) {
my @captures;
my @parts = @parts; # localise
- # strip Captures into list
+ # strip CaptureArgs into list
push(@captures, splice(@parts, 0, $capture_attr->[0]));
# try the remaining parts against children of this action
);
}
+ if ($part =~ m(^/)) {
+ Catalyst::Exception->throw(
+ "Absolute parameters to PathPart not allowed registering ${action}"
+ );
+ }
+
$action->attributes->{PartPath} = [ $part ];
unshift(@{ $children->{$part} ||= [] }, $action);
($self->{actions} ||= {})->{'/'.$action->reverse} = $action;
- unless ($action->attributes->{Captures}) {
+ unless ($action->attributes->{CaptureArgs}) {
unshift(@{ $self->{endpoints} ||= [] }, $action);
}
my $parent = "DUMMY";
my $curr = $action;
while ($curr) {
- if (my $cap = $curr->attributes->{Captures}) {
+ if (my $cap = $curr->attributes->{CaptureArgs}) {
return undef unless @captures >= $cap->[0]; # not enough captures
unshift(@parts, splice(@captures, -$cap->[0]));
}