svn merge -r 9548:9549 http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Chained.pm
index dccd3c9..4edb889 100644 (file)
@@ -222,8 +222,13 @@ sub register {
           "Multiple Chained attributes not supported registering ${action}"
         );
     }
+    my $chained_to = $chained_attr[0];
 
-    my $children = ($self->{children_of}{ $chained_attr[0] } ||= {});
+    Catalyst::Exception->throw(
+      "Actions cannot chain to themselves registering /${action}"
+    ) if ($chained_to eq '/' . $action);
+
+    my $children = ($self->{children_of}->{ $chained_to } ||= {});
 
     my @path_part = @{ $action->attributes->{PathPart} || [] };