File Coverage

blib/lib/Log/Any/Proxy/Null.pm
Criterion Covered Total %
statement 25 25 100.0
branch 2 4 50.0
condition n/a
subroutine 11 11 100.0
pod 0 2 0.0
total 38 42 90.4


line stmt bran cond sub pod time code
1 25     25   791 use 5.008001;
  25         85  
2 25     25   139 use strict;
  25         47  
  25         508  
3 25     25   109 use warnings;
  25         90  
  25         1366  
4              
5             package Log::Any::Proxy::Null;
6              
7             # ABSTRACT: Log::Any generator proxy for no adapters
8             our $VERSION = '1.715';
9              
10 25     25   9371 use Log::Any::Adapter::Util ();
  25         59  
  25         581  
11 25     25   10265 use Log::Any::Proxy;
  25         78  
  25         4267  
12             our @ISA = qw/Log::Any::Proxy/;
13              
14             # Null proxy objects waiting for inflation into regular proxy objects
15             my @nulls;
16              
17             sub new {
18 10     10 0 51 my $obj = shift->SUPER::new( @_ );
19 10         30 push @nulls, $obj;
20 10         31 return $obj;
21             }
22              
23             sub inflate_nulls {
24 41     41 0 226 bless shift( @nulls ), 'Log::Any::Proxy' while @nulls;
25             }
26              
27             my %aliases = Log::Any::Adapter::Util::log_level_aliases();
28              
29             # Set up methods/aliases and detection methods/aliases
30             foreach my $name ( Log::Any::Adapter::Util::logging_methods(), keys(%aliases) )
31             {
32             my $namef = $name . "f";
33             my $super_name = "SUPER::" . $name;
34             my $super_namef = "SUPER::" . $namef;
35 25     25   207 no strict 'refs';
  25         65  
  25         3117  
36             *{$name} = sub {
37 29 50   29   10086 return unless defined wantarray;
        2      
38 29         157 return shift->$super_name( @_ );
39             };
40             *{$namef} = sub {
41 28 50   28   11896 return unless defined wantarray;
42 28         145 return shift->$super_namef( @_ );
43             };
44             }
45              
46             1;
47              
48             __END__