X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FChained.pm;h=4bf8e79cf3846260b74123ee750a4dee8343ae51;hb=1b666f0f00e409a24119e175633892a9fa2484f2;hp=5ae5152c10db69a4b6c448d6de0c542866860761;hpb=ffca3e960f527321fa30c5ffdfe6ffd2a984af59;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 5ae5152..4bf8e79 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -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 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 actions will be run before the chain dispatching begins. In every other aspect, C actions behave as documented. -The Cing to other actions does just what you would expect. But if -you C out of a chain, the rest of the chain will not get called -after the C. +The Cing 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 out of a chain, the rest of the chain will not get +called after the C. =head2 match_captures