[Catalyst-commits] r8232 -
Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType
gbjk at dev.catalyst.perl.org
gbjk at dev.catalyst.perl.org
Mon Aug 18 20:03:08 BST 2008
Author: gbjk
Date: 2008-08-18 20:03:08 +0100 (Mon, 18 Aug 2008)
New Revision: 8232
Modified:
Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType/Chained.pm
Log:
DispatchType/Chained:
A chain of equal actions but less captures should win over one with more captures.
Less captures is taken to mean it did so less ambiguously, and therefore wins the fight.
A chain of more actions will lose to one of less actions even if it had less captures, though.
i.e.: Actions beat Captures, but Captures decide betwixt Actions.
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType/Chained.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType/Chained.pm 2008-08-18 12:02:54 UTC (rev 8231)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/DispatchType/Chained.pm 2008-08-18 19:03:08 UTC (rev 8232)
@@ -157,7 +157,14 @@
my ($actions, $captures, $action_parts) = $self->recurse_match(
$c, '/'.$action->reverse, \@parts
);
- if ($actions && (!$best_action || $#$action_parts < $#{$best_action->{parts}})){
+ # No best action currently
+ # OR The action has less parts
+ # OR The action has equal parts but less captured data (ergo more defined)
+ if ($actions &&
+ (!$best_action ||
+ $#$action_parts < $#{$best_action->{parts}} ||
+ ($#$action_parts == $#{$best_action->{parts}} &&
+ $#$captures < $#{$best_action->{captures}}))){
$best_action = {
actions => [ $action, @$actions ],
captures=> [ @captures, @$captures ],
More information about the Catalyst-commits
mailing list