line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Config::INI::Access; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
114389
|
use vars qw ($VERSION); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
251
|
|
4
|
|
|
|
|
|
|
$VERSION = '0.9999'; |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
123
|
|
7
|
3
|
|
|
3
|
|
5993
|
use Config::INI::Reader; |
|
3
|
|
|
|
|
249367
|
|
|
3
|
|
|
|
|
1358
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
11
|
|
|
|
|
|
|
our @EXPORT = qw(config); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $Config = {}; |
14
|
|
|
|
|
|
|
bless $Config, __PACKAGE__; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $AUTOLOAD; |
17
|
|
|
|
|
|
|
sub AUTOLOAD { |
18
|
19
|
|
|
19
|
|
33
|
my $key = shift; |
19
|
19
|
|
|
|
|
28
|
my $subkey = $AUTOLOAD; |
20
|
|
|
|
|
|
|
|
21
|
19
|
|
|
|
|
85
|
$subkey =~ s{.*::}{}; |
22
|
|
|
|
|
|
|
|
23
|
19
|
50
|
|
|
|
65
|
$key = exists $key->{$subkey} ? $key->{$subkey} : bless {}, __PACKAGE__; |
24
|
|
|
|
|
|
|
|
25
|
19
|
100
|
|
|
|
39
|
if (ref $key) { |
26
|
9
|
|
|
|
|
98
|
return bless $key, __PACKAGE__; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
10
|
|
|
|
|
56
|
return $key; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
|
0
|
sub DESTROY { |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub config { |
37
|
15
|
|
|
15
|
0
|
631
|
return $Config; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub load { |
41
|
3
|
|
|
3
|
0
|
7
|
my $this = shift; |
42
|
3
|
|
|
|
|
7
|
my $filename = shift; |
43
|
|
|
|
|
|
|
|
44
|
3
|
50
|
|
|
|
92
|
return 0 unless -e $filename; |
45
|
|
|
|
|
|
|
|
46
|
3
|
|
|
|
|
50
|
my $ini = Config::INI::Reader->read_file($filename); |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
3391
|
my $c = 0; |
49
|
3
|
|
|
|
|
20
|
foreach my $section (keys %$ini) { |
50
|
7
|
100
|
|
|
|
32
|
unless ($Config->{$section}) { |
51
|
6
|
100
|
|
|
|
15
|
if ('_' eq $section) { |
52
|
2
|
|
|
|
|
5
|
foreach my $key (keys %{$ini->{$section}}) { |
|
2
|
|
|
|
|
11
|
|
53
|
4
|
|
|
|
|
12
|
$Config->{$key} = $ini->{$section}->{$key}; |
54
|
4
|
|
|
|
|
13
|
$c++; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
else { |
58
|
4
|
|
|
|
|
13
|
$Config->{$section} = $ini->{$section}; |
59
|
4
|
|
|
|
|
8
|
$c += keys %{$ini->{$section}}; |
|
4
|
|
|
|
|
16
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
else { |
63
|
1
|
|
|
|
|
2
|
foreach my $key (keys %{$ini->{$section}}) { |
|
1
|
|
|
|
|
5
|
|
64
|
1
|
|
|
|
|
6
|
$Config->{$section}->{$key} = $ini->{$section}->{$key}; |
65
|
1
|
|
|
|
|
5
|
$c++; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
3
|
|
|
|
|
28
|
return $c; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |