| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# |
|
2
|
|
|
|
|
|
|
# This file is part of Config-Any-Log4perl |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# This software is copyright (c) 2012 by Loïc TROCHET. |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
|
7
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
package Config::Any::Log4perl; |
|
10
|
|
|
|
|
|
|
{ |
|
11
|
|
|
|
|
|
|
$Config::Any::Log4perl::VERSION = '0.130020'; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
# ABSTRACT: Config::Any loader for Log4perl config files |
|
14
|
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
84079
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
112
|
|
|
16
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
87
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
3
|
|
|
3
|
|
2777
|
use Config::Any::Base; |
|
|
3
|
|
|
|
|
1021
|
|
|
|
3
|
|
|
|
|
87
|
|
|
19
|
3
|
|
|
3
|
|
2525
|
use parent qw(Config::Any::Base); |
|
|
3
|
|
|
|
|
892
|
|
|
|
3
|
|
|
|
|
16
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub extensions |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
1
|
|
|
1
|
1
|
13590
|
return qw(log4perl); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub load |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
3
|
|
|
3
|
1
|
1878
|
my $class = shift; |
|
31
|
3
|
|
|
|
|
8
|
my $file = shift; |
|
32
|
3
|
|
100
|
|
|
59
|
my $args = shift || {}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
3
|
50
|
|
|
|
155
|
open(FILE, $file) or die "Failed to open file <$file>: $!"; |
|
35
|
3
|
|
|
|
|
85
|
my @lines = ; |
|
36
|
|
|
|
|
|
|
|
|
37
|
3
|
50
|
|
|
|
33
|
return {} unless grep /\S/, @lines; |
|
38
|
|
|
|
|
|
|
|
|
39
|
3
|
|
|
|
|
7
|
my $config = {}; |
|
40
|
|
|
|
|
|
|
|
|
41
|
3
|
|
|
|
|
11
|
while (@lines) |
|
42
|
|
|
|
|
|
|
{ |
|
43
|
15
|
|
|
|
|
51
|
local $_ = shift @lines; |
|
44
|
15
|
|
|
|
|
27
|
s/^\s*#.*//; |
|
45
|
15
|
50
|
|
|
|
42
|
next unless /\S/; |
|
46
|
|
|
|
|
|
|
|
|
47
|
15
|
|
|
|
|
37
|
while (/(.+?)\\\s*$/) |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
0
|
|
|
|
|
0
|
my $prev = $1; |
|
50
|
0
|
|
|
|
|
0
|
my $next = shift @lines; |
|
51
|
0
|
|
|
|
|
0
|
$next =~ s/^ +//g; |
|
52
|
0
|
|
|
|
|
0
|
$next =~ s/^#.*//; |
|
53
|
0
|
|
|
|
|
0
|
$_ = $prev . $next; |
|
54
|
0
|
|
|
|
|
0
|
chomp; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
15
|
50
|
|
|
|
126
|
if (my ($key, $val) = /(\S+?)\s*=\s*(.*)/) |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
15
|
|
|
|
|
29
|
$val =~ s/\s+$//; |
|
60
|
15
|
|
|
|
|
57
|
$config->{$key} = $val; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
3
|
100
|
|
|
|
22
|
return exists $args->{config_name} ? { $args->{config_name} => $config } : $config; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |