line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
32
|
|
|
32
|
|
183
|
use strict; |
|
32
|
|
|
|
|
57
|
|
|
32
|
|
|
|
|
1341
|
|
2
|
32
|
|
|
32
|
|
166
|
use warnings; |
|
32
|
|
|
|
|
69
|
|
|
32
|
|
|
|
|
1010
|
|
3
|
|
|
|
|
|
|
|
4
|
32
|
|
|
32
|
|
208
|
use Carp qw(croak); |
|
32
|
|
|
|
|
127
|
|
|
32
|
|
|
|
|
9808
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub add_defaults { |
7
|
6
|
|
|
6
|
1
|
403
|
my ($self, $name, $defaults) = @_; |
8
|
6
|
100
|
|
|
|
22
|
croak "Defaults '${name}' is already defined" if $self->has_defaults($name); |
9
|
|
|
|
|
|
|
|
10
|
5
|
100
|
|
|
|
29
|
if (ref $defaults ne 'HASH') { |
11
|
1
|
|
|
|
|
38
|
croak "Expected hash reference but got '", ref $defaults, "'"; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
|
|
99
|
$self->_defaults->set($name => $defaults); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub defaults { |
18
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
19
|
0
|
|
|
|
|
0
|
return $self->_defaults->keys; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub has_defaults { |
23
|
19
|
|
|
19
|
1
|
1184
|
my ($self, $name) = @_; |
24
|
19
|
|
|
|
|
1100
|
return $self->_defaults->exists($name); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub get_defaults { |
28
|
9
|
|
|
9
|
1
|
17
|
my ($self, $name) = @_; |
29
|
|
|
|
|
|
|
|
30
|
9
|
50
|
|
|
|
27
|
if ($self->has_defaults($name)) { |
31
|
9
|
|
|
|
|
333
|
return $self->_defaults->get($name); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
croak "Can't find defaults '$name'"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
__END__ |