X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FChained.pm;h=1a3fd5660bf5abb938805436879392070a73356c;hp=2b27ec49eebb9d57e12b11a937482e41ae94977e;hb=ba3f8a81296a8aca76d63fc21d7a5397289e5c6f;hpb=02459769c2a00053a6dd3869ea741de61294deca diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 2b27ec4..1a3fd56 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,18 +122,19 @@ 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.')'; } unless ($p eq $parents[0]) { $name = "-> ${name}"; } - if (defined(my $extra = $p->list_extra_info->{HTTP_METHODS})) { - $name .= ' ('.join(', ', @$extra).')'; - } push(@rows, [ '', $name ]); } - push(@rows, [ '', (@rows ? "=> " : '')."/${endpoint}" ]); + push(@rows, [ '', (@rows ? "=> " : '').($extra ? "$extra " : '')."/${endpoint}" ]); $rows[0][0] = join('/', '', @parts) || '/'; $paths->row(@$_) for @rows; } @@ -142,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>.