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=b9d6d07a07a102d32b4e9c2a3585ab13948cdc47;hp=421175f0c48c2894c60ac0f39affac89d4bd4c10;hb=130b45ec858db6863e3d6959f7a6e3b6908cd48e;hpb=70949f28d6d56c8c882cd937b9c3be5e04aaba62 diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 421175f..b9d6d07 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -298,13 +298,29 @@ sub recurse_match { # The current best action might also be Args(0), # but we couldn't chose between then anyway so we'll take the last seen - if (!$best_action || + if ( + !$best_action || @parts < @{$best_action->{parts}} || - (!@parts && defined($args_attr) && $args_attr eq "0")){ + ( + !@parts && + defined($args_attr) && + ( + $args_attr eq "0" && + ( + ($c->config->{use_chained_args_0_special_case}||0) || + ( + exists($best_action->{args_attr}) && defined($best_action->{args_attr}) ? + ($best_action->{args_attr} ne 0) : 1 + ) + ) + ) + ) + ){ $best_action = { actions => [ $action ], captures=> [], parts => \@parts, + args_attr => $args_attr, n_pathparts => scalar(@pathparts), }; }