Guess that's done then (except the things I forgot)..
[catagits/CatalystX-Debug-RequestHeaders.git] / lib / CatalystX / Debug / RequestHeaders.pm
1 package CatalystX::Debug::RequestHeaders;
2 use Moose::Role;
3 use namespace::autoclean;
4
5 requires 'log_request_headers';
6
7 around 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
17 1;
18
19 =head1 NAME
20
21 CatalystX::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     /;
28
29 =head1 DESCRIPTION
30
31 Prints a L<Text::SimpleTable> style table containing all the headers sent from the
32 user's browser to the application for each request when the application is in debug mode.
33
34 =head1 METHODS
35
36 =head2 log_request_headers
37
38 This hook method in L<Catalyst> is wrapped to call the L<Catalyst/log_headers> method
39 for the request headers.
40
41 =head1 BUGS
42
43 None known, but there probably are some.
44
45 Patches are welcome, as are bug reports in the L<rt.cpan.org> bug tracker.
46
47 =head1 AUTHOR
48
49 Tomas Doran (t0m) C<< <bobtfish@bobtfish.net> >>.
50
51 =head1 COPYRIGHT & LICENSE
52
53 Copyright 2010 the above author(s).
54
55 This sofware is free software, and is licensed under the same terms as perl itself.
56
57 =cut
58