File Coverage

blib/lib/Log/Any/Proxy/Null.pm
Criterion Covered Total %
statement 25 25 100.0
branch 3 4 75.0
condition n/a
subroutine 10 10 100.0
pod 0 2 0.0
total 38 41 92.6


line stmt bran cond sub pod time code
1 40     70   150412 use 5.008001;
  40         137  
2 40     40   174 use strict;
  40         93  
  40         851  
3 40     40   120 use warnings;
  40         73  
  40         2788  
4              
5             package Log::Any::Proxy::Null;
6              
7             # ABSTRACT: Log::Any generator proxy for no adapters
8             our $VERSION = '1.718';
9              
10 40     40   10971 use Log::Any::Adapter::Util ();
  40         103  
  40         932  
11 40     40   15655 use Log::Any::Proxy;
  40         106  
  40         9540  
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 12     12 0 62 my $obj = shift->SUPER::new( @_ );
19 12         24 push @nulls, $obj;
20 12         39 return $obj;
21             }
22              
23             sub inflate_nulls {
24 43     43 0 187 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 40     40   300 no strict 'refs';
  40         1629  
  40         5242  
36             *{$name} = sub {
37 30 100   30   13168 return unless defined wantarray;
38 29         218 return shift->$super_name( @_ );
39             };
40             *{$namef} = sub {
41 28 50   28   12357 return unless defined wantarray;
42 28         186 return shift->$super_namef( @_ );
43             };
44             }
45              
46             1;
47              
48             __END__