File Coverage

blib/lib/Log/Dispatch/Configurator/Perl.pm
Criterion Covered Total %
statement 22 23 95.6
branch 2 4 50.0
condition n/a
subroutine 8 9 88.8
pod 0 5 0.0
total 32 41 78.0


line stmt bran cond sub pod time code
1             package Log::Dispatch::Configurator::Perl;
2 3     3   129070 use strict;
  3         8  
  3         141  
3 3     3   17 use warnings;
  3         8  
  3         112  
4 3     3   17 use Carp qw/croak/;
  3         9  
  3         238  
5 3     3   2742 use parent 'Log::Dispatch::Configurator';
  3         1712  
  3         16  
6              
7             our $VERSION = '0.0132';
8              
9             sub new {
10 2     2 0 33 my ($class, $file) = @_;
11              
12 2         9 my $self = bless { file => $file }, $class;
13 2         10 $self->exec_file;
14 2         7 return $self;
15             }
16              
17              
18             sub exec_file {
19 2     2 0 5 my $self = shift;
20              
21 2 50       1677 my $config = do $self->{file}
22             or croak "could not load conf file: $self->{file}";
23 2         62 $self->{'_config'} = $config;
24             }
25              
26              
27             sub reload {
28 0     0 0 0 $_[0]->exec_file;
29             }
30              
31              
32             sub get_attrs_global {
33 2     2 0 378 my $self = shift;
34              
35             +{
36 2 50       17 format => undef,
37             dispatchers => (exists $self->{'_config'}{'dispatchers'})
38             ? $self->{'_config'}{'dispatchers'} : [],
39             };
40             }
41              
42              
43             sub get_attrs {
44 4     4 0 8602 $_[0]->{'_config'}{$_[1]};
45             }
46              
47             1;
48              
49             __END__