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   463 use 5.008001;
  25         81  
2 25     25   140 use strict;
  25         55  
  25         526  
3 25     25   114 use warnings;
  25         90  
  25         1554  
4              
5             package Log::Any::Proxy::Null;
6              
7             # ABSTRACT: Log::Any generator proxy for no adapters
8             our $VERSION = '1.717';
9              
10 25     25   10070 use Log::Any::Adapter::Util ();
  25         67  
  25         603  
11 25     25   11060 use Log::Any::Proxy;
  25         86  
  25         4463  
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 48 my $obj = shift->SUPER::new( @_ );
19 10         27 push @nulls, $obj;
20 10         32 return $obj;
21             }
22              
23             sub inflate_nulls {
24 41     41 0 227 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   209 no strict 'refs';
  25         59  
  25         3283  
36             *{$name} = sub {
37 29 50   29   7212 return unless defined wantarray;
        29      
38 29         141 return shift->$super_name( @_ );
39             };
40             *{$namef} = sub {
41 28 50   28   8611 return unless defined wantarray;
42 28         151 return shift->$super_namef( @_ );
43             };
44             }
45              
46             1;
47              
48             __END__