tweaked the "list_extra_info" debugging method and converted old action info to use...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / ActionRole / HTTPMethods.pm
index 2112cb3..a0ab7e2 100644 (file)
@@ -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,14 @@ sub _has_expected_http_method {
 
 sub allowed_http_methods { @{shift->attributes->{Method}||[]} }
 
+around 'list_extra_info', sub {
+  my ($orig, $self, @args) = @_;
+  return {
+    %{ $self->$orig(@args) }, 
+    +{ HTTP_METHODS => [sort $self->allowed_http_methods] }
+  };
+};
+
 1;
 
 =head1 NAME
@@ -112,6 +120,12 @@ allowed methods (see L</http_methods>) 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
+
+Adds a key => [@values] "HTTP_METHODS" whose value is an ArrayRef of sorted
+allowed methods to the ->list_extra_info HashRef.  This is used primarily for
+debugging output.
+
 =head2 _has_expected_http_method ($expected)
 
 Private method which returns 1 if C<$expected> matches one of the allowed