Backported [1133] dispatcher fix to trunk
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Dispatcher.pm
index 3d43f9c..cb01934 100644 (file)
@@ -209,6 +209,7 @@ sub get_action {
             push @results, [$result] if $result;
             my $visitor = Tree::Simple::Visitor::FindByPath->new;
 
+            SEARCH:
             for my $part ( split '/', $namespace ) {
                 $visitor->setSearchPath($part);
                 $parent->accept($visitor);
@@ -216,7 +217,12 @@ sub get_action {
                 my $uid   = $child->getUID if $child;
                 my $match = $c->actions->{private}->{$uid}->{$action} if $uid;
                 push @results, [$match] if $match;
-                $parent = $child if $child;
+                if ($child) {
+                    $parent = $child;
+                }
+                else {
+                    last SEARCH;
+                }
             }
 
         }