line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Config::Constants::Perl; |
3
|
|
|
|
|
|
|
|
4
|
15
|
|
|
15
|
|
27729
|
use strict; |
|
15
|
|
|
|
|
57
|
|
|
15
|
|
|
|
|
705
|
|
5
|
15
|
|
|
15
|
|
76
|
use warnings; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
4782
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
14
|
|
|
14
|
1
|
1592
|
my ($class, $file) = @_; |
11
|
14
|
50
|
|
|
|
76
|
(defined $file) |
12
|
|
|
|
|
|
|
|| die "No config file supplied"; |
13
|
14
|
|
33
|
|
|
715
|
my $self = bless({}, ref($class) || $class); |
14
|
14
|
|
|
|
|
62
|
$self->_init($file); |
15
|
13
|
|
|
|
|
104
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _init { |
19
|
6
|
|
|
6
|
|
11
|
my ($self, $file) = @_; |
20
|
6
|
50
|
33
|
|
|
212
|
(-e $file && -f $file) |
21
|
|
|
|
|
|
|
|| die "Bad config file '$file' either it doesn't exist or it's not a file"; |
22
|
6
|
|
|
|
|
10
|
my $config = eval { do $file }; |
|
6
|
|
|
|
|
2903
|
|
23
|
6
|
50
|
|
|
|
108
|
(ref($config) eq 'HASH') |
24
|
|
|
|
|
|
|
|| die "Config file must return a hash"; |
25
|
6
|
|
|
|
|
49
|
$self->{_config} = $config; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
13
|
|
|
13
|
1
|
3425
|
sub modules { keys %{(shift)->{_config}} } |
|
13
|
|
|
|
|
82
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub constants { |
31
|
22
|
|
|
22
|
1
|
42
|
my ($self, $module) = @_; |
32
|
22
|
50
|
|
|
|
67
|
(defined $module) |
33
|
|
|
|
|
|
|
|| die "You must supply a module name"; |
34
|
22
|
50
|
|
|
|
81
|
(exists $self->{_config}->{$module}) |
35
|
|
|
|
|
|
|
|| die "The module ($module) is not found in this config"; |
36
|
22
|
|
|
|
|
33
|
return map {{ $_ => $self->{_config}->{$module}->{$_} }} keys %{$self->{_config}->{$module}}; |
|
34
|
|
|
|
|
190
|
|
|
22
|
|
|
|
|
86
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |