Guess that's done then (except the things I forgot)..
[catagits/CatalystX-Debug-RequestHeaders.git] / lib / CatalystX / Debug / RequestHeaders.pm
CommitLineData
4b9bbaf9 1package CatalystX::Debug::RequestHeaders;
2ab3d8c4 2use Moose::Role;
4b9bbaf9 3use namespace::autoclean;
4
2ab3d8c4 5requires 'log_request_headers';
6
7around log_request_headers => sub {
8 my $orig = shift;
9 my $c = shift;
10 my $headers = shift; # an HTTP::Headers instance
11
12 return unless $c->debug;
13
14 $c->log_headers('request', $headers);
15};
16
4b9bbaf9 171;
18
19=head1 NAME
20
2ab3d8c4 21CatalystX::Debug::RequestHeaders - Log the full request headers sent to a Catalyst application in debug mode
22
23=head1 SYNOPSIS
24
25 use Catalyst qw/
26 +CatalystX::Debug::RequestHeaders
27 /;
4b9bbaf9 28
29=head1 DESCRIPTION
30
2ab3d8c4 31Prints a L<Text::SimpleTable> style table containing all the headers sent from the
32user's browser to the application for each request when the application is in debug mode.
33
4b9bbaf9 34=head1 METHODS
35
2ab3d8c4 36=head2 log_request_headers
37
38This hook method in L<Catalyst> is wrapped to call the L<Catalyst/log_headers> method
39for the request headers.
40
4b9bbaf9 41=head1 BUGS
42
2ab3d8c4 43None known, but there probably are some.
44
45Patches are welcome, as are bug reports in the L<rt.cpan.org> bug tracker.
46
4b9bbaf9 47=head1 AUTHOR
48
2ab3d8c4 49Tomas Doran (t0m) C<< <bobtfish@bobtfish.net> >>.
50
4b9bbaf9 51=head1 COPYRIGHT & LICENSE
52
2ab3d8c4 53Copyright 2010 the above author(s).
4b9bbaf9 54
55This sofware is free software, and is licensed under the same terms as perl itself.
56
57=cut
58