File Coverage

blib/lib/Log/Dispatch/Configurator.pm
Criterion Covered Total %
statement 20 21 95.2
branch 4 6 66.6
condition n/a
subroutine 9 10 90.0
pod 0 7 0.0
total 33 44 75.0


line stmt bran cond sub pod time code
1             package Log::Dispatch::Configurator;
2              
3 15     15   47828 use strict;
  15         303  
  15         634  
4 15     15   82 use vars qw($VERSION);
  15         30  
  15         5459  
5             $VERSION = '1.00';
6              
7             sub new {
8 1     1 0 16 my($class, $file) = @_;
9 1         7 bless { file => $file }, $class;
10             }
11              
12             sub myinit {
13 16     16 0 40 my $self = shift;
14 16 50       97 $self->{LDC_ctime} = 0 unless defined $self->{LDC_ctime};
15 16 50       271 $self->{LDC_watch} = 0 unless defined $self->{LDC_watch};
16             }
17              
18 2     2 0 3 sub reload { }
19              
20             sub needs_reload {
21 2     2 0 5 my $self = shift;
22 2         98 return $self->{LDC_ctime} < (stat($self->{file}))[9];
23             }
24              
25             sub should_watch {
26 14     14 0 31 my $self = shift;
27 14 100       63 $self->{LDC_watch} = shift if @_;
28 14         113 return $self->{LDC_watch};
29             }
30              
31             sub _abstract_method {
32 1     1   9 require Carp;
33 1         258 Carp::croak(shift, " is an abstract method of ", __PACKAGE__);
34             }
35              
36 1     1 0 3 sub get_attrs_global { _abstract_method('get_attrs_global') }
37 0     0 0   sub get_attrs { _abstract_method('get_attrs') }
38              
39             1;
40             __END__