Guess that's done then (except the things I forgot)..
Tomas Doran [Sun, 28 Mar 2010 17:46:04 +0000 (18:46 +0100)]
Makefile.PL
README
lib/CatalystX/Debug/RequestHeaders.pm
t/lib/TestApp.pm

index 873df33..6252fc5 100644 (file)
@@ -10,7 +10,7 @@ all_from 'lib/CatalystX/Debug/RequestHeaders.pm';
 requires 'Moose';
 requires 'namespace::autoclean';
 
-build_requires 'Catalyst::Runtime' => '5.80015';
+build_requires 'Catalyst::Runtime' => '5.8022';
 build_requires 'Test::WWW::Mechanize::Catalyst';
 build_requires 'Test::More' => '0.88';
 
diff --git a/README b/README
index e69de29..192ae2e 100644 (file)
--- a/README
+++ b/README
@@ -0,0 +1,33 @@
+NAME
+    CatalystX::Debug::RequestHeaders - Log the full request headers sent to
+    a Catalyst application in debug mode
+
+SYNOPSIS
+        use Catalyst qw/
+            +CatalystX::Debug::RequestHeaders
+        /;
+
+DESCRIPTION
+    Prints a Text::SimpleTable style table containing all the headers sent
+    from the user's browser to the application for each request when the
+    application is in debug mode.
+
+METHODS
+  log_request_headers
+    This hook method in Catalyst is wrapped to call the "log_headers" in
+    Catalyst method for the request headers.
+
+BUGS
+    None known, but there probably are some.
+
+    Patches are welcome, as are bug reports in the rt.cpan.org bug tracker.
+
+AUTHOR
+    Tomas Doran (t0m) "<bobtfish@bobtfish.net>".
+
+COPYRIGHT & LICENSE
+    Copyright 2010 the above author(s).
+
+    This sofware is free software, and is licensed under the same terms as
+    perl itself.
+
index d2d09ba..5e74591 100644 (file)
@@ -1,24 +1,56 @@
 package CatalystX::Debug::RequestHeaders;
-use Moose;
+use Moose::Role;
 use namespace::autoclean;
 
+requires 'log_request_headers';
+
+around log_request_headers => sub {
+    my $orig    = shift;
+    my $c       = shift;
+    my $headers = shift;    # an HTTP::Headers instance
+
+    return unless $c->debug;
+
+    $c->log_headers('request', $headers);
+};
+
 1;
 
 =head1 NAME
 
-CatalystX::Debug::RequestHeaders - 
+CatalystX::Debug::RequestHeaders - Log the full request headers sent to a Catalyst application in debug mode
+
+=head1 SYNOPSIS
+
+    use Catalyst qw/
+        +CatalystX::Debug::RequestHeaders
+    /;
 
 =head1 DESCRIPTION
 
+Prints a L<Text::SimpleTable> style table containing all the headers sent from the
+user's browser to the application for each request when the application is in debug mode.
+
 =head1 METHODS
 
+=head2 log_request_headers
+
+This hook method in L<Catalyst> is wrapped to call the L<Catalyst/log_headers> method
+for the request headers.
+
 =head1 BUGS
 
+None known, but there probably are some.
+
+Patches are welcome, as are bug reports in the L<rt.cpan.org> bug tracker.
+
 =head1 AUTHOR
 
+Tomas Doran (t0m) C<< <bobtfish@bobtfish.net> >>.
+
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2009 the above author(s).
+Copyright 2010 the above author(s).
 
 This sofware is free software, and is licensed under the same terms as perl itself.
 
index a18a1ef..d76831f 100644 (file)
@@ -2,7 +2,9 @@ package TestApp;
 use Moose;
 use namespace::autoclean;
 
-use Catalyst;
+use Catalyst qw/
+    +CatalystX::Debug::RequestHeaders
+/;
 
 extends 'Catalyst';