appease t/author/spelling.t
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Chained.pm
index 5ae5152..4bf8e79 100644 (file)
@@ -100,6 +100,7 @@ sub list {
         my @parts = (defined($args) ? (("*") x $args) : '...');
         my @parents = ();
         my $parent = "DUMMY";
+        my $extra  = $self->_list_extra_http_methods($endpoint);
         my $curr = $endpoint;
         while ($curr) {
             if (my $cap = $curr->list_extra_info->{CaptureArgs}) {
@@ -121,6 +122,10 @@ sub list {
         my @rows;
         foreach my $p (@parents) {
             my $name = "/${p}";
+
+            if (defined(my $extra = $self->_list_extra_http_methods($p))) {
+                $name = "${extra} ${name}";
+            }
             if (defined(my $cap = $p->list_extra_info->{CaptureArgs})) {
                 $name .= ' ('.$cap.')';
             }
@@ -129,7 +134,7 @@ sub list {
             }
             push(@rows, [ '', $name ]);
         }
-        push(@rows, [ '', (@rows ? "=> " : '')."/${endpoint}" ]);
+        push(@rows, [ '', (@rows ? "=> " : '').($extra ? "$extra " : '')."/${endpoint}" ]);
         $rows[0][0] = join('/', '', @parts) || '/';
         $paths->row(@$_) for @rows;
     }
@@ -139,6 +144,12 @@ sub list {
         if $has_unattached_actions;
 }
 
+sub _list_extra_http_methods {
+    my ( $self, $action ) = @_;
+    return unless defined $action->list_extra_info->{HTTP_METHODS};
+    return join(', ', @{$action->list_extra_info->{HTTP_METHODS}});
+}
+
 =head2 $self->match( $c, $path )
 
 Calls C<recurse_match> to see if a chain matches the C<$path>.
@@ -674,9 +685,11 @@ of the endpoint of the chain, not on the chained actions way. The
 C<auto> actions will be run before the chain dispatching begins. In
 every other aspect, C<auto> actions behave as documented.
 
-The C<forward>ing to other actions does just what you would expect. But if
-you C<detach> out of a chain, the rest of the chain will not get called
-after the C<detach>.
+The C<forward>ing to other actions does just what you would expect. i.e.
+only the target action is run. The actions that that action is chained
+to are not run.
+If you C<detach> out of a chain, the rest of the chain will not get
+called after the C<detach>.
 
 =head2 match_captures