Changelog and sed s/website authors/application authors/
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Chained.pm
index 71a8fd3..49fad32 100644 (file)
@@ -39,6 +39,8 @@ Catalyst::DispatchType::Chained - Path Part DispatchType
 
 =head1 SYNOPSIS
 
+Path part matching, allowing several actions to sequentially take care of processing a request:
+
   #   root action - captures one argument after it
   sub foo_setup : Chained('/') PathPart('foo') CaptureArgs(1) {
       my ( $self, $c, $foo_arg ) = @_;
@@ -53,7 +55,16 @@ Catalyst::DispatchType::Chained - Path Part DispatchType
 
 =head1 DESCRIPTION
 
-See L</USAGE>.
+Dispatch type managing default behaviour.  For more information on
+dispatch types, see:
+
+=over 4
+
+=item * L<Catalyst::Manual::Intro> for how they affect application authors
+
+=item * L<Catalyst::DispatchType> for implementation information.
+
+=back
 
 =head1 METHODS
 
@@ -70,7 +81,7 @@ sub list {
 
     my $column_width = Catalyst::Utils::term_width() - 35 - 9;
     my $paths = Text::SimpleTable->new(
-       [ 35, 'Path Spec' ], [ 36, 'Private' ], [ $column_width, 'Private' ]
+       [ 35, 'Path Spec' ], [ $column_width, 'Private' ],
     );
 
     my $has_unattached_actions;
@@ -258,8 +269,13 @@ sub register {
           "Multiple Chained attributes not supported registering ${action}"
         );
     }
+    my $chained_to = $chained_attr[0];
+
+    Catalyst::Exception->throw(
+      "Actions cannot chain to themselves registering /${action}"
+    ) if ($chained_to eq '/' . $action);
 
-    my $children = ($self->_children_of->{ $chained_attr[0] } ||= {});
+    my $children = ($self->_children_of->{ $chained_to } ||= {});
 
     my @path_part = @{ $action->attributes->{PathPart} || [] };