line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Config::YAMLMacros::YAML; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
55
|
|
5
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
39
|
|
6
|
2
|
|
|
2
|
|
1873
|
use File::Slurp; |
|
2
|
|
|
|
|
47206
|
|
|
2
|
|
|
|
|
198
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
2
|
|
|
2
|
|
4365
|
use YAML::Syck qw(Dump); |
|
2
|
|
|
|
|
6730
|
|
|
2
|
|
|
|
|
1549
|
|
9
|
2
|
|
|
2
|
|
20
|
use Carp qw(confess); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1050
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(YAML::Syck); |
12
|
|
|
|
|
|
|
our @EXPORT = qw(Load Dump LoadFile); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub LoadFile |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
0
|
0
|
my ($file) = @_; |
17
|
0
|
|
|
|
|
0
|
my @r; |
18
|
0
|
0
|
|
|
|
0
|
if (wantarray) { |
19
|
0
|
|
|
|
|
0
|
@r = eval { YAML::Syck::Load(scalar(read_file($file))); } |
|
0
|
|
|
|
|
0
|
|
20
|
|
|
|
|
|
|
} else { |
21
|
0
|
|
|
|
|
0
|
$r[0] = eval { YAML::Syck::Load(scalar(read_file($file))); } |
|
0
|
|
|
|
|
0
|
|
22
|
|
|
|
|
|
|
} |
23
|
0
|
0
|
|
|
|
0
|
yaml_error($@, $file, scalar(read_file($file))) if $@; |
24
|
0
|
0
|
|
|
|
0
|
return @r if wantarray; |
25
|
0
|
|
|
|
|
0
|
return $r[0]; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub Load |
29
|
|
|
|
|
|
|
{ |
30
|
27
|
|
|
27
|
0
|
37
|
my @r; |
31
|
27
|
|
|
|
|
130
|
my $opts = { file => 'unknown file' }; |
32
|
27
|
100
|
|
|
|
93
|
$opts = shift if ref $_[0]; |
33
|
27
|
50
|
|
|
|
77
|
if (wantarray) { |
34
|
0
|
|
|
|
|
0
|
@r = eval { YAML::Syck::Load(@_); } |
|
0
|
|
|
|
|
0
|
|
35
|
|
|
|
|
|
|
} else { |
36
|
27
|
|
|
|
|
35
|
$r[0] = eval { YAML::Syck::Load(@_); } |
|
27
|
|
|
|
|
99
|
|
37
|
|
|
|
|
|
|
} |
38
|
27
|
50
|
|
|
|
2090
|
yaml_error($@, $opts->{file}, join('', @_)) if $@; |
39
|
27
|
50
|
|
|
|
62
|
return @r if wantarray; |
40
|
27
|
|
|
|
|
87
|
return $r[0]; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub yaml_error |
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
0
|
0
|
|
my ($error, $filename, $input) = @_; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my @x = split(/\n/, $input); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $from = 0; |
50
|
0
|
|
|
|
|
|
my $to = 10000; |
51
|
0
|
|
|
|
|
|
my $eline; |
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
if ($error =~ /Syck parser \(line (\d+), column 87\): .*/) { |
|
|
0
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$eline = $1; |
55
|
|
|
|
|
|
|
} elsif ($error =~ /Code: [A-Z_\d]+\n\s+Line: (\d+)/) { |
56
|
0
|
|
|
|
|
|
$eline = $1; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
if (defined $eline) { |
60
|
0
|
|
|
|
|
|
$from = $eline - 20; |
61
|
0
|
|
|
|
|
|
$to = $eline + 20; |
62
|
|
|
|
|
|
|
} |
63
|
0
|
0
|
|
|
|
|
$from = 0 if $from < 0; |
64
|
0
|
0
|
|
|
|
|
$to = $#x if $to > $#x; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $context = join("\n", map { sprintf("%-4d%s", $_, $x[$_]) } $from..$to); |
|
0
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
die "YAML INPUT:\n$context\nYAML Error when loading $filename: $error"; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |