$paths->row(@$_) for @rows;
}
- $c->log->debug( "Loaded Path Part actions:\n" . $paths->draw );
+ $c->log->debug( "Loaded Chained actions:\n" . $paths->draw . "\n" );
}
=head2 $self->match( $c, $path )
my @try_actions = @{$children->{$try_part}};
TRY_ACTION: foreach my $action (@try_actions) {
if (my $capture_attr = $action->attributes->{CaptureArgs}) {
+
+ # Short-circuit if not enough remaining parts
+ next TRY_ACTION unless @parts >= $capture_attr->[0];
+
my @captures;
my @parts = @parts; # localise
if ($parent eq '.') {
$parent = '/'.$action->namespace;
} elsif ($parent !~ m/^\//) {
- $parent = '/'.join('/', $action->namespace, $parent);
+ if ($action->namespace) {
+ $parent = '/'.join('/', $action->namespace, $parent);
+ } else {
+ $parent = '/'.$parent; # special case namespace '' (root)
+ }
}
} else {
$parent = '/'
my ( $self, $action, $captures ) = @_;
return undef unless ($action->attributes->{Chained}
- && $action->attributes->{Args});
+ && !$action->attributes->{CaptureArgs});
my @parts = ();
my @captures = @$captures;
while ($curr) {
if (my $cap = $curr->attributes->{CaptureArgs}) {
return undef unless @captures >= $cap->[0]; # not enough captures
- unshift(@parts, splice(@captures, -$cap->[0]));
+ if ($cap->[0]) {
+ unshift(@parts, splice(@captures, -$cap->[0]));
+ }
}
if (my $pp = $curr->attributes->{PartPath}) {
unshift(@parts, $pp->[0])
- if (defined $pp->[0] && length $pp->[0]);
+ if (defined($pp->[0]) && length($pp->[0]));
}
$parent = $curr->attributes->{Chained}->[0];
$curr = $self->{actions}{$parent};
Has to be specified for every child in the chain. Possible values are
absolute and relative private action paths, with the relatives pointing
to the current controller, or a single slash C</> to tell Catalyst that
-this is the root of a chain. The attribute C<:Chained> without aguments
+this is the root of a chain. The attribute C<:Chained> without arguments
also defaults to the C</> behavior.
Because you can specify an absolute path to the parent action, it