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     69   165051 use 5.008001;
  40         124  
2 40     40   182 use strict;
  40         87  
  40         882  
3 40     40   178 use warnings;
  40         76  
  40         2746  
4              
5             package Log::Any::Proxy::Null;
6              
7             # ABSTRACT: Log::Any generator proxy for no adapters
8             our $VERSION = '1.720';
9              
10 40     40   10160 use Log::Any::Adapter::Util ();
  40         73  
  40         848  
11 40     40   14583 use Log::Any::Proxy;
  40         94  
  40         6560  
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 57 my $obj = shift->SUPER::new( @_ );
19 12         46 push @nulls, $obj;
20 12         36 return $obj;
21             }
22              
23             sub inflate_nulls {
24 43     43 0 117 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   1840 no strict 'refs';
  40         830  
  40         4871  
36             *{$name} = sub {
37 29 100   29   8979 return unless defined wantarray;
38 28         136 return shift->$super_name( @_ );
39             };
40             *{$namef} = sub {
41 28 50   28   8714 return unless defined wantarray;
42 28         138 return shift->$super_namef( @_ );
43             };
44             }
45              
46             1;
47              
48             __END__