From: John Napiorkowski Date: Fri, 15 Feb 2013 19:49:16 +0000 (-0500) Subject: new action method "list_extra_info" for better debugging, and did this for the new... X-Git-Tag: 5.90020~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3c0da3ece98e535f1c168bb985980583498894ad;p=catagits%2FCatalyst-Runtime.git new action method "list_extra_info" for better debugging, and did this for the new http method actionrole --- diff --git a/lib/Catalyst/Action.pm b/lib/Catalyst/Action.pm index ebedf59..8c51d13 100644 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@ -103,6 +103,8 @@ sub number_of_captures { return $self->attributes->{CaptureArgs}[0] || 0; } +sub list_extra_info { } + __PACKAGE__->meta->make_immutable; 1; @@ -180,6 +182,10 @@ Returns the number of args this action expects. This is 0 if the action doesn't Returns the number of captures this action expects for L actions. +=head2 list_extra_info + +An array of values useful to improve debugging + =head2 meta Provided by Moose. diff --git a/lib/Catalyst/ActionRole/HTTPMethods.pm b/lib/Catalyst/ActionRole/HTTPMethods.pm index 2112cb3..4f2a0d5 100644 --- a/lib/Catalyst/ActionRole/HTTPMethods.pm +++ b/lib/Catalyst/ActionRole/HTTPMethods.pm @@ -2,7 +2,7 @@ package Catalyst::ActionRole::HTTPMethods; use Moose::Role; -requires 'match', 'match_captures'; +requires 'match', 'match_captures', 'list_extra_info'; around ['match','match_captures'], sub { my ($orig, $self, $ctx, @args) = @_; @@ -29,6 +29,8 @@ sub _has_expected_http_method { sub allowed_http_methods { @{shift->attributes->{Method}||[]} } +sub list_extra_info { sort shift->allowed_http_methods } + 1; =head1 NAME @@ -112,6 +114,10 @@ allowed methods (see L) and zero otherwise. An array of strings that are the allowed http methods for matching this action normalized as noted above (using X-Method* overrides). +=head2 list_extra_info + +Returns an array of the allowed HTTP Methods, sorted. + =head2 _has_expected_http_method ($expected) Private method which returns 1 if C<$expected> matches one of the allowed