File Coverage

lib/Log/Contextual/Router/LogDispatchouli.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 18 100.0


line stmt bran cond sub pod time code
1 1     1   1144 use strict;
  1         2  
  1         39  
2 1     1   7 use warnings;
  1         2  
  1         69  
3              
4             package Log::Contextual::Router::LogDispatchouli;
5             BEGIN {
6 1     1   32 $Log::Contextual::Router::LogDispatchouli::AUTHORITY = 'cpan:KENTNL';
7             }
8             {
9             $Log::Contextual::Router::LogDispatchouli::VERSION = '0.001000';
10             }
11              
12             # ABSTRACT: Proxy Log::Dispatchouli without getting wrong carp levels
13              
14 1     1   871 use Moo;
  1         19133  
  1         7  
15              
16             extends 'Log::Contextual::Router';
17              
18              
19             around handle_log_request => sub {
20             my ( $orig, $self, %message_info ) = @_;
21             require Carp;
22             ## no critic (ProhibitPackageVars)
23             $message_info{caller_level}++;
24             local $Carp::CarpLevel = $message_info{caller_level};
25             return $self->$orig(%message_info);
26             };
27              
28 1     1   2137 no Moo;
  1         2  
  1         5  
29              
30             1;
31              
32             __END__
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             Log::Contextual::Router::LogDispatchouli - Proxy Log::Dispatchouli without getting wrong carp levels
41              
42             =head1 VERSION
43              
44             version 0.001000
45              
46             =head1 METHODS
47              
48             =head2 C<handle_log_request>
49              
50             This is simply a wrapper around L<< C<Log::Contextual::Router::handle_log_request>|Log::Contextual::Router/handle_log_request >> that locally sets C<$Carp::CarpLevel> to the value needed so L<< C<Log::Dispatchouli>|Log::Dispatchouli >> reports errors from the right place.
51              
52             =head1 AUTHOR
53              
54             Kent Fredric <kentfredric@gmail.com>
55              
56             =head1 COPYRIGHT AND LICENSE
57              
58             This software is copyright (c) 2013 by Kent Fredric <kentfredric@gmail.com>.
59              
60             This is free software; you can redistribute it and/or modify it under
61             the same terms as the Perl 5 programming language system itself.
62              
63             =cut