line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
42
|
|
|
42
|
|
316
|
use strict; |
|
42
|
|
|
|
|
91
|
|
|
42
|
|
|
|
|
1363
|
|
2
|
42
|
|
|
42
|
|
252
|
use warnings; |
|
42
|
|
|
|
|
95
|
|
|
42
|
|
|
|
|
2494
|
|
3
|
|
|
|
|
|
|
package YAML::PP::Exception; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.036_002'; # TRIAL VERSION |
6
|
|
|
|
|
|
|
|
7
|
42
|
|
|
42
|
|
51834
|
use overload '""' => \&to_string; |
|
42
|
|
|
|
|
43069
|
|
|
42
|
|
|
|
|
387
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
124
|
|
|
124
|
0
|
757
|
my ($class, %args) = @_; |
11
|
|
|
|
|
|
|
my $self = bless { |
12
|
|
|
|
|
|
|
line => $args{line}, |
13
|
|
|
|
|
|
|
msg => $args{msg}, |
14
|
|
|
|
|
|
|
next => $args{next}, |
15
|
|
|
|
|
|
|
where => $args{where}, |
16
|
|
|
|
|
|
|
yaml => $args{yaml}, |
17
|
|
|
|
|
|
|
got => $args{got}, |
18
|
|
|
|
|
|
|
expected => $args{expected}, |
19
|
|
|
|
|
|
|
column => $args{column}, |
20
|
124
|
|
|
|
|
858
|
}, $class; |
21
|
124
|
|
|
|
|
414
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub to_string { |
25
|
372
|
|
|
372
|
0
|
658
|
my ($self) = @_; |
26
|
372
|
|
|
|
|
643
|
my $next = $self->{next}; |
27
|
372
|
|
|
|
|
548
|
my $line = $self->{line}; |
28
|
372
|
|
|
|
|
509
|
my $column = $self->{column}; |
29
|
|
|
|
|
|
|
|
30
|
372
|
|
|
|
|
530
|
my $yaml = ''; |
31
|
372
|
|
|
|
|
688
|
for my $token (@$next) { |
32
|
429
|
100
|
|
|
|
784
|
last if $token->{name} eq 'EOL'; |
33
|
363
|
|
|
|
|
664
|
$yaml .= $token->{value}; |
34
|
|
|
|
|
|
|
} |
35
|
372
|
50
|
|
|
|
749
|
$column = '???' unless defined $column; |
36
|
|
|
|
|
|
|
|
37
|
372
|
|
|
|
|
618
|
my $remaining_yaml = $self->{yaml}; |
38
|
372
|
50
|
|
|
|
649
|
$remaining_yaml = '' unless defined $remaining_yaml; |
39
|
372
|
|
|
|
|
586
|
$yaml .= $remaining_yaml; |
40
|
|
|
|
|
|
|
{ |
41
|
372
|
|
|
|
|
475
|
local $@; # avoid bug in old Data::Dumper |
|
372
|
|
|
|
|
478
|
|
42
|
372
|
|
|
|
|
1782
|
require Data::Dumper; |
43
|
372
|
|
|
|
|
601
|
local $Data::Dumper::Useqq = 1; |
44
|
372
|
|
|
|
|
499
|
local $Data::Dumper::Terse = 1; |
45
|
372
|
|
|
|
|
1276
|
$yaml = Data::Dumper->Dump([$yaml], ['yaml']); |
46
|
372
|
|
|
|
|
15248
|
chomp $yaml; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
372
|
|
|
|
|
572
|
my $lines = 5; |
50
|
372
|
|
|
|
|
476
|
my @fields; |
51
|
|
|
|
|
|
|
|
52
|
372
|
100
|
66
|
|
|
1168
|
if ($self->{got} and $self->{expected}) { |
53
|
144
|
|
|
|
|
220
|
$lines = 6; |
54
|
144
|
|
|
|
|
218
|
$line = $self->{got}->{line}; |
55
|
144
|
|
|
|
|
223
|
$column = $self->{got}->{column} + 1; |
56
|
|
|
|
|
|
|
@fields = ( |
57
|
|
|
|
|
|
|
"Line" => $line, |
58
|
|
|
|
|
|
|
"Column" => $column, |
59
|
144
|
|
|
|
|
578
|
"Expected", join(" ", @{ $self->{expected} }), |
60
|
|
|
|
|
|
|
"Got", $self->{got}->{name}, |
61
|
|
|
|
|
|
|
"Where", $self->{where}, |
62
|
144
|
|
|
|
|
219
|
"YAML", $yaml, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
else { |
66
|
|
|
|
|
|
|
@fields = ( |
67
|
|
|
|
|
|
|
"Line" => $line, |
68
|
|
|
|
|
|
|
"Column" => $column, |
69
|
|
|
|
|
|
|
"Message", $self->{msg}, |
70
|
|
|
|
|
|
|
"Where", $self->{where}, |
71
|
228
|
|
|
|
|
702
|
"YAML", $yaml, |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
} |
74
|
372
|
|
|
|
|
1338
|
my $fmt = join "\n", ("%-10s: %s") x $lines; |
75
|
372
|
|
|
|
|
2270
|
my $string = sprintf $fmt, @fields; |
76
|
372
|
|
|
|
|
11931
|
return $string; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |