new action method "list_extra_info" for better debugging, and did this for the new...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Chained.pm
index ede2b69..5f72fba 100644 (file)
@@ -201,9 +201,10 @@ 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;
 
                 # Short-circuit if not enough remaining parts
-                next TRY_ACTION unless @parts >= ($capture_attr->[0]||0);
+                next TRY_ACTION unless @parts >= $capture_attr->[0];
 
                 my @captures;
                 my @parts = @parts; # localise
@@ -252,7 +253,7 @@ sub recurse_match {
 
                 if (!$best_action                       ||
                     @parts < @{$best_action->{parts}}   ||
-                    (!@parts && $args_attr eq 0)){
+                    (!@parts && defined($args_attr) && $args_attr eq "0")){
                     $best_action = {
                         actions => [ $action ],
                         captures=> [],
@@ -360,7 +361,7 @@ sub uri_for_action {
     my $curr = $action;
     while ($curr) {
         if (my $cap = $curr->attributes->{CaptureArgs}) {
-            return undef unless @captures >= $cap->[0]; # not enough captures
+            return undef unless @captures >= ($cap->[0]||0); # not enough captures
             if ($cap->[0]) {
                 unshift(@parts, splice(@captures, -$cap->[0]));
             }