File Coverage

blib/lib/CatalystX/Debug/RequestHeaders.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


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