line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
42
|
|
|
42
|
|
309
|
use strict; |
|
42
|
|
|
|
|
78
|
|
|
42
|
|
|
|
|
1367
|
|
2
|
42
|
|
|
42
|
|
213
|
use warnings; |
|
42
|
|
|
|
|
84
|
|
|
42
|
|
|
|
|
2368
|
|
3
|
|
|
|
|
|
|
package YAML::PP::Exception; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.036_001'; # TRIAL VERSION |
6
|
|
|
|
|
|
|
|
7
|
42
|
|
|
42
|
|
49936
|
use overload '""' => \&to_string; |
|
42
|
|
|
|
|
42023
|
|
|
42
|
|
|
|
|
380
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
124
|
|
|
124
|
0
|
662
|
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
|
|
|
|
|
784
|
}, $class; |
21
|
124
|
|
|
|
|
422
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub to_string { |
25
|
372
|
|
|
372
|
0
|
675
|
my ($self) = @_; |
26
|
372
|
|
|
|
|
615
|
my $next = $self->{next}; |
27
|
372
|
|
|
|
|
556
|
my $line = $self->{line}; |
28
|
372
|
|
|
|
|
538
|
my $column = $self->{column}; |
29
|
|
|
|
|
|
|
|
30
|
372
|
|
|
|
|
539
|
my $yaml = ''; |
31
|
372
|
|
|
|
|
722
|
for my $token (@$next) { |
32
|
429
|
100
|
|
|
|
837
|
last if $token->{name} eq 'EOL'; |
33
|
363
|
|
|
|
|
656
|
$yaml .= $token->{value}; |
34
|
|
|
|
|
|
|
} |
35
|
372
|
50
|
|
|
|
728
|
$column = '???' unless defined $column; |
36
|
|
|
|
|
|
|
|
37
|
372
|
|
|
|
|
594
|
my $remaining_yaml = $self->{yaml}; |
38
|
372
|
50
|
|
|
|
642
|
$remaining_yaml = '' unless defined $remaining_yaml; |
39
|
372
|
|
|
|
|
561
|
$yaml .= $remaining_yaml; |
40
|
|
|
|
|
|
|
{ |
41
|
372
|
|
|
|
|
488
|
local $@; # avoid bug in old Data::Dumper |
|
372
|
|
|
|
|
512
|
|
42
|
372
|
|
|
|
|
1636
|
require Data::Dumper; |
43
|
372
|
|
|
|
|
615
|
local $Data::Dumper::Useqq = 1; |
44
|
372
|
|
|
|
|
478
|
local $Data::Dumper::Terse = 1; |
45
|
372
|
|
|
|
|
1353
|
$yaml = Data::Dumper->Dump([$yaml], ['yaml']); |
46
|
372
|
|
|
|
|
15278
|
chomp $yaml; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
372
|
|
|
|
|
526
|
my $lines = 5; |
50
|
372
|
|
|
|
|
527
|
my @fields; |
51
|
|
|
|
|
|
|
|
52
|
372
|
100
|
66
|
|
|
1251
|
if ($self->{got} and $self->{expected}) { |
53
|
144
|
|
|
|
|
206
|
$lines = 6; |
54
|
144
|
|
|
|
|
213
|
$line = $self->{got}->{line}; |
55
|
144
|
|
|
|
|
203
|
$column = $self->{got}->{column} + 1; |
56
|
|
|
|
|
|
|
@fields = ( |
57
|
|
|
|
|
|
|
"Line" => $line, |
58
|
|
|
|
|
|
|
"Column" => $column, |
59
|
144
|
|
|
|
|
605
|
"Expected", join(" ", @{ $self->{expected} }), |
60
|
|
|
|
|
|
|
"Got", $self->{got}->{name}, |
61
|
|
|
|
|
|
|
"Where", $self->{where}, |
62
|
144
|
|
|
|
|
211
|
"YAML", $yaml, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
else { |
66
|
|
|
|
|
|
|
@fields = ( |
67
|
|
|
|
|
|
|
"Line" => $line, |
68
|
|
|
|
|
|
|
"Column" => $column, |
69
|
|
|
|
|
|
|
"Message", $self->{msg}, |
70
|
|
|
|
|
|
|
"Where", $self->{where}, |
71
|
228
|
|
|
|
|
719
|
"YAML", $yaml, |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
} |
74
|
372
|
|
|
|
|
1030
|
my $fmt = join "\n", ("%-10s: %s") x $lines; |
75
|
372
|
|
|
|
|
1880
|
my $string = sprintf $fmt, @fields; |
76
|
372
|
|
|
|
|
11830
|
return $string; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |