| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pod::Coverage::TrustMe::Parser; |
|
2
|
11
|
|
|
11
|
|
122
|
use strict; |
|
|
11
|
|
|
|
|
26
|
|
|
|
11
|
|
|
|
|
328
|
|
|
3
|
11
|
|
|
11
|
|
58
|
use warnings; |
|
|
11
|
|
|
|
|
23
|
|
|
|
11
|
|
|
|
|
620
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.002000'; |
|
6
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
|
7
|
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
7606
|
use Pod::Simple (); |
|
|
11
|
|
|
|
|
354514
|
|
|
|
11
|
|
|
|
|
542
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Pod::Simple); |
|
10
|
11
|
|
|
11
|
|
93
|
use Carp qw(croak); |
|
|
11
|
|
|
|
|
23
|
|
|
|
11
|
|
|
|
|
14420
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
|
13
|
56
|
|
|
56
|
1
|
126
|
my $class = shift; |
|
14
|
56
|
|
|
|
|
332
|
my $self = $class->SUPER::new(@_); |
|
15
|
56
|
|
|
|
|
1842
|
$self->accept_targets_as_text('Pod::Coverage'); |
|
16
|
56
|
|
|
|
|
1315
|
$self->{+__PACKAGE__} = {}; |
|
17
|
56
|
|
|
|
|
182
|
return $self; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub parse_lines { |
|
21
|
391
|
|
|
391
|
1
|
74839
|
my $self = shift; |
|
22
|
391
|
|
|
|
|
1514
|
$self->SUPER::parse_lines(@_); |
|
23
|
391
|
|
|
|
|
69416
|
my $me = $self->{+__PACKAGE__}; |
|
24
|
|
|
|
|
|
|
{ |
|
25
|
|
|
|
|
|
|
# these are regexes |
|
26
|
391
|
|
100
|
|
|
1143
|
my $trusted = $me->{trusted} ||= []; |
|
27
|
391
|
|
|
|
|
597
|
my %seen; |
|
28
|
391
|
|
|
|
|
1276
|
@$trusted = sort grep !$seen{$_}++, @$trusted; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
391
|
|
100
|
|
|
605
|
my $links = $me->{links} ||= []; |
|
|
391
|
|
|
|
|
995
|
|
|
32
|
391
|
|
|
|
|
570
|
my %seen; |
|
33
|
391
|
|
|
|
|
1598
|
@$links = sort grep !$seen{$_}++, @$links; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
{ |
|
36
|
391
|
|
100
|
|
|
566
|
my $covered = $me->{covered} ||= []; |
|
|
391
|
|
|
|
|
621
|
|
|
|
391
|
|
|
|
|
950
|
|
|
37
|
391
|
|
|
|
|
627
|
my %seen; |
|
38
|
391
|
|
|
|
|
3249
|
@$covered = sort grep !$seen{$_}++, @$covered; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
391
|
|
|
|
|
1013
|
return; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub ignore_empty { |
|
44
|
247
|
|
|
247
|
1
|
442
|
my $self = shift; |
|
45
|
247
|
|
|
|
|
437
|
my $me = $self->{+__PACKAGE__}; |
|
46
|
247
|
100
|
|
|
|
620
|
if (@_) { |
|
47
|
1
|
|
|
|
|
4
|
$me->{ignore_empty} = shift; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
247
|
|
|
|
|
693
|
return $me->{ignore_empty}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _handle_element_start { |
|
53
|
1644
|
|
|
1644
|
|
308742
|
my $self = shift; |
|
54
|
1644
|
|
|
|
|
2794
|
my $me = $self->{+__PACKAGE__}; |
|
55
|
1644
|
|
|
|
|
3055
|
my ($name, $attr) = @_; |
|
56
|
1644
|
100
|
100
|
|
|
11215
|
if ($name eq 'for') { |
|
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
57
|
8
|
|
|
|
|
19
|
push @{ $me->{in} }, $attr; |
|
|
8
|
|
|
|
|
29
|
|
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
elsif ($name eq 'L' && $attr->{type} eq 'pod' && defined $attr->{to}) { |
|
60
|
93
|
|
|
|
|
154
|
push @{ $me->{links} }, "$attr->{to}"; |
|
|
93
|
|
|
|
|
294
|
|
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
elsif ($name eq 'item-text' || $name eq 'item-bullet' || $name =~ /\Ahead[2-9]\z/) { |
|
63
|
246
|
|
|
|
|
515
|
delete $me->{maybe_covered}; |
|
64
|
246
|
|
|
|
|
520
|
$me->{consider} = $name; |
|
65
|
246
|
|
|
|
|
493
|
$me->{consider_text} = ''; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
elsif ($name =~ /\Ahead1\z/) { |
|
68
|
101
|
|
|
|
|
213
|
delete $me->{maybe_covered}; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
1644
|
|
|
|
|
5251
|
$self->SUPER::_handle_element_start(@_); |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
sub _handle_element_end { |
|
73
|
1644
|
|
|
1644
|
|
18605
|
my $self = shift; |
|
74
|
1644
|
|
|
|
|
2575
|
my $me = $self->{+__PACKAGE__}; |
|
75
|
1644
|
|
|
|
|
2831
|
my ($name) = @_; |
|
76
|
1644
|
100
|
100
|
|
|
5903
|
if ($name eq 'for') { |
|
|
|
100
|
|
|
|
|
|
|
77
|
8
|
|
|
|
|
15
|
pop @{ $self->{+__PACKAGE__}{in} }; |
|
|
8
|
|
|
|
|
25
|
|
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
elsif ($name eq ($me->{consider}||'')) { |
|
80
|
246
|
|
|
|
|
650
|
delete $me->{consider}; |
|
81
|
246
|
|
|
|
|
517
|
my $text = delete $me->{consider_text}; |
|
82
|
246
|
|
|
|
|
1514
|
my @covered = $text =~ /([^\s\|,\/]+)/g; |
|
83
|
246
|
|
|
|
|
598
|
for my $covered ( @covered ) { |
|
84
|
|
|
|
|
|
|
# looks like a method |
|
85
|
599
|
|
|
|
|
1171
|
$covered =~ s/.*->//; |
|
86
|
|
|
|
|
|
|
# looks fully qualified |
|
87
|
599
|
|
|
|
|
964
|
$covered =~ s/\A\w+(?:::\w+)*::(\w+)/$1/; |
|
88
|
|
|
|
|
|
|
# looks like it includes parameters |
|
89
|
599
|
|
|
|
|
1611
|
$covered =~ s/(\w+)[;\(].*/$1/; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
246
|
|
|
|
|
1320
|
@covered = grep /\A\w+\z/, @covered; |
|
92
|
246
|
100
|
|
|
|
650
|
if ($self->ignore_empty) { |
|
93
|
2
|
|
|
|
|
3
|
push @{ $me->{maybe_covered} }, @covered; |
|
|
2
|
|
|
|
|
9
|
|
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
else { |
|
96
|
244
|
|
|
|
|
388
|
push @{ $me->{covered} }, @covered; |
|
|
244
|
|
|
|
|
763
|
|
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
} |
|
99
|
1644
|
|
|
|
|
3692
|
$self->SUPER::_handle_element_end(@_); |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub _handle_text { |
|
103
|
1940
|
|
|
1940
|
|
21328
|
my $self = shift; |
|
104
|
1940
|
|
|
|
|
3197
|
my $me = $self->{+__PACKAGE__}; |
|
105
|
1940
|
|
|
|
|
3583
|
my ($text) = @_; |
|
106
|
1940
|
|
|
|
|
3115
|
my $in = $me->{in}; |
|
107
|
1940
|
100
|
100
|
|
|
6569
|
if ($in && @$in && $in->[-1]{target} =~ /\APod::Coverage(?:::Trust(?:Me|Pod))?\z/) { |
|
|
|
100
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
108
|
9
|
|
|
|
|
21
|
my @trusted; |
|
109
|
9
|
|
|
|
|
46
|
for my $token ($text =~ /(\S+)/g) { |
|
110
|
10
|
100
|
|
|
|
33
|
if ($token eq '*EVERYTHING*') { |
|
111
|
1
|
|
|
|
|
8
|
push @trusted, qr{.?}; |
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
else { |
|
114
|
9
|
|
|
|
|
18
|
my $re = eval { qr/\A(?:$token)\z/ }; |
|
|
9
|
|
|
|
|
208
|
|
|
115
|
9
|
50
|
|
|
|
44
|
if (!$re) { |
|
116
|
0
|
|
0
|
|
|
0
|
my $file = $self->{source_filename} || ''; |
|
117
|
0
|
|
0
|
|
|
0
|
my $line = $in->[-1]{start_line} || ''; |
|
118
|
0
|
|
|
|
|
0
|
croak "Error compiling Pod::Coverage regex /$token/ at $file line $line: $@"; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
9
|
|
|
|
|
27
|
push @trusted, $re; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
9
|
|
|
|
|
22
|
push @{ $me->{trusted} }, @trusted; |
|
|
9
|
|
|
|
|
27
|
|
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
elsif ($me->{consider}) { |
|
127
|
314
|
|
|
|
|
773
|
$me->{consider_text} .= $text; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
elsif ($me->{maybe_covered}) { |
|
130
|
1
|
|
|
|
|
2
|
push @{ $me->{covered} }, @{ delete $me->{maybe_covered} }; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
3
|
|
|
131
|
|
|
|
|
|
|
} |
|
132
|
1940
|
|
|
|
|
4285
|
$self->SUPER::_handle_text(@_); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub links { |
|
136
|
10
|
|
|
10
|
1
|
23
|
my $self = shift; |
|
137
|
10
|
|
|
|
|
60
|
return $self->{+__PACKAGE__}{links}; |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub trusted { |
|
141
|
23
|
|
|
23
|
1
|
47
|
my $self = shift; |
|
142
|
23
|
|
|
|
|
277
|
return $self->{+__PACKAGE__}{trusted}; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub covered { |
|
146
|
54
|
|
|
54
|
1
|
109
|
my $self = shift; |
|
147
|
54
|
|
|
|
|
481
|
return $self->{+__PACKAGE__}{covered}; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
1; |
|
151
|
|
|
|
|
|
|
__END__ |