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   443 use 5.008001;
  25         85  
2 25     25   131 use strict;
  25         66  
  25         549  
3 25     25   115 use warnings;
  25         85  
  25         1418  
4              
5             package Log::Any::Proxy::Null;
6              
7             # ABSTRACT: Log::Any generator proxy for no adapters
8             our $VERSION = '1.716';
9              
10 25     25   9871 use Log::Any::Adapter::Util ();
  25         56  
  25         591  
11 25     25   10415 use Log::Any::Proxy;
  25         72  
  25         4470  
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         25 push @nulls, $obj;
20 10         33 return $obj;
21             }
22              
23             sub inflate_nulls {
24 41     41 0 198 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   206 no strict 'refs';
  25         61  
  25         3147  
36             *{$name} = sub {
37 29 50   29   9801 return unless defined wantarray;
        29      
38 29         134 return shift->$super_name( @_ );
39             };
40             *{$namef} = sub {
41 28 50   28   11556 return unless defined wantarray;
42 28         154 return shift->$super_namef( @_ );
43             };
44             }
45              
46             1;
47              
48             __END__