if (my $capture_attr = $action->attributes->{CaptureArgs}) {
# Short-circuit if not enough remaining parts
- next TRY_ACTION unless @parts >= $capture_attr->[0];
+ next TRY_ACTION unless @parts >= ($capture_attr->[0]||0);
my @captures;
my @parts = @parts; # localise
# strip CaptureArgs into list
push(@captures, splice(@parts, 0, $capture_attr->[0]));
+ # check if the action may fit, depending on a given test by the app
+ if ($action->can('match_captures')) { next TRY_ACTION unless $action->match_captures($c, \@captures) }
+
# try the remaining parts against children of this action
my ($actions, $captures, $action_parts, $n_pathparts) = $self->recurse_match(
$c, '/'.$action->reverse, \@parts
}
__PACKAGE__->meta->make_immutable;
+1;
=head1 USAGE
you C<detach> out of a chain, the rest of the chain will not get called
after the C<detach>.
+=head2 match_captures
+
+A method which can optionally be implemented by actions to
+stop chain matching.
+
+See L<Catalyst::Action> for further details.
+
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm