Skip to content

Commit

Permalink
Fix CaptureAttr count defaulting, it was defaulting the arrayref, not…
Browse files Browse the repository at this point in the history
… the value
  • Loading branch information
ilmari committed Mar 18, 2013
1 parent cedb28e commit 3f91cb2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Catalyst/DispatchType/Chained.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
Expand Down

0 comments on commit 3f91cb2

Please sign in to comment.