line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Confman; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19658
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
446
|
use Confman::API; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
75
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
9
|
|
|
|
|
|
|
our $DEFAULT; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub load_conf_set { |
12
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
my $getter = shift; |
15
|
0
|
|
|
|
|
|
my $conf_set_name = shift; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $conf_set = $self->api->find_by_name($conf_set_name); |
18
|
|
|
|
|
|
|
{ |
19
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self; |
|
0
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
172
|
|
21
|
0
|
|
|
0
|
|
|
*{$class.'::'.$getter} = sub { $conf_set; }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
} |
23
|
0
|
0
|
|
|
|
|
return $conf_set ? $conf_set->pairs : undef; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub api { |
27
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
28
|
0
|
|
0
|
|
|
|
$self->{_api} ||= Confman::API->new->load_config; |
29
|
0
|
|
|
|
|
|
return $self->{_api}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
34
|
0
|
|
0
|
|
|
|
my $self = bless({}, ref($class) || $class); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$self; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub default { |
40
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
0
|
|
|
|
$DEFAULT ||= $self->new(); |
43
|
0
|
|
|
|
|
|
$DEFAULT; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
__END__ |