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=44f890e59037d5f4e35b958169514a46d66070c1;hp=4bf8e79cf3846260b74123ee750a4dee8343ae51;hb=87106f31bcbbacc350449a6fbe5d6de50b876057;hpb=64111aca12ab4c4b405737d9fc67aea47354c6d7 diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 4bf8e79..44f890e 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -212,16 +212,16 @@ sub recurse_match { my @try_actions = @{$children->{$try_part}}; TRY_ACTION: foreach my $action (@try_actions) { if (my $capture_attr = $action->attributes->{CaptureArgs}) { - $capture_attr ||= 0; + my $capture_count = $capture_attr->[0] || 0; # Short-circuit if not enough remaining parts - next TRY_ACTION unless @parts >= $capture_attr->[0]; + next TRY_ACTION unless @parts >= $capture_count; my @captures; my @parts = @parts; # localise # strip CaptureArgs into list - push(@captures, splice(@parts, 0, $capture_attr->[0])); + push(@captures, splice(@parts, 0, $capture_count)); # 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) } @@ -341,7 +341,7 @@ sub register { $args = Data::Dumper::Dumper($args); Catalyst::Exception->throw( "Invalid Args($args) for action " . $action->reverse() . - " (use 'Args' or 'Args()'" + " (use 'Args' or 'Args()')" ); } }