| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pod::Coverage::TrustMe::Parser; |
|
2
|
25
|
|
|
25
|
|
157
|
use strict; |
|
|
25
|
|
|
|
|
49
|
|
|
|
25
|
|
|
|
|
921
|
|
|
3
|
25
|
|
|
25
|
|
133
|
use warnings; |
|
|
25
|
|
|
|
|
81
|
|
|
|
25
|
|
|
|
|
2343
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.002001'; |
|
6
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
|
7
|
|
|
|
|
|
|
|
|
8
|
25
|
|
|
25
|
|
16526
|
use Pod::Simple (); |
|
|
25
|
|
|
|
|
1168670
|
|
|
|
25
|
|
|
|
|
1591
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Pod::Simple); |
|
10
|
25
|
|
|
25
|
|
230
|
use Carp qw(croak); |
|
|
25
|
|
|
|
|
51
|
|
|
|
25
|
|
|
|
|
40597
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
|
13
|
89
|
|
|
89
|
1
|
283
|
my $class = shift; |
|
14
|
89
|
|
|
|
|
699
|
my $self = $class->SUPER::new(@_); |
|
15
|
89
|
|
|
|
|
5447
|
$self->accept_targets_as_text('Pod::Coverage'); |
|
16
|
89
|
|
|
|
|
2075
|
$self->{+__PACKAGE__} = {}; |
|
17
|
89
|
|
|
|
|
356
|
return $self; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub ignore_empty { |
|
21
|
502
|
|
|
502
|
1
|
1070
|
my $self = shift; |
|
22
|
502
|
|
|
|
|
1072
|
my $me = $self->{+__PACKAGE__}; |
|
23
|
502
|
100
|
|
|
|
1445
|
if (@_) { |
|
24
|
1
|
|
|
|
|
2
|
$me->{ignore_empty} = shift; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
502
|
|
|
|
|
1480
|
return $me->{ignore_empty}; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _handle_element_start { |
|
30
|
3009
|
|
|
3009
|
|
1188874
|
my $self = shift; |
|
31
|
3009
|
|
|
|
|
6318
|
my $me = $self->{+__PACKAGE__}; |
|
32
|
3009
|
|
|
|
|
6584
|
my ($name, $attr) = @_; |
|
33
|
3009
|
100
|
100
|
|
|
26161
|
if ($name eq 'for') { |
|
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
34
|
10
|
|
|
|
|
30
|
push @{ $me->{in} }, $attr; |
|
|
10
|
|
|
|
|
39
|
|
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
elsif ($name eq 'L' && $attr->{type} eq 'pod' && defined $attr->{to}) { |
|
37
|
202
|
|
|
|
|
725
|
my $to = "$attr->{to}"; |
|
38
|
116
|
|
|
|
|
376
|
push @{ $me->{links} }, $to |
|
39
|
202
|
100
|
|
|
|
4197
|
unless $me->{links_hash}{$to}++; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
elsif ($name eq 'item-text' || $name eq 'item-bullet' || $name =~ /\Ahead[2-9]\z/) { |
|
42
|
501
|
|
|
|
|
1130
|
delete $me->{maybe_covered}; |
|
43
|
501
|
|
|
|
|
1289
|
$me->{consider} = $name; |
|
44
|
501
|
|
|
|
|
1290
|
$me->{consider_text} = ''; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
elsif ($name =~ /\Ahead1\z/) { |
|
47
|
193
|
|
|
|
|
428
|
delete $me->{maybe_covered}; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
3009
|
|
|
|
|
9358
|
$self->SUPER::_handle_element_start(@_); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
sub _handle_element_end { |
|
52
|
3009
|
|
|
3009
|
|
46380
|
my $self = shift; |
|
53
|
3009
|
|
|
|
|
5372
|
my $me = $self->{+__PACKAGE__}; |
|
54
|
3009
|
|
|
|
|
5893
|
my ($name) = @_; |
|
55
|
3009
|
100
|
100
|
|
|
13242
|
if ($name eq 'for') { |
|
|
|
100
|
|
|
|
|
|
|
56
|
10
|
|
|
|
|
54
|
pop @{ $self->{+__PACKAGE__}{in} }; |
|
|
10
|
|
|
|
|
58
|
|
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
elsif ($name eq ($me->{consider}||'')) { |
|
59
|
501
|
|
|
|
|
1213
|
delete $me->{consider}; |
|
60
|
501
|
|
|
|
|
1111
|
my $text = delete $me->{consider_text}; |
|
61
|
501
|
|
|
|
|
3563
|
my @covered = $text =~ /([^\s\|,\/]+)/g; |
|
62
|
501
|
|
|
|
|
1343
|
for my $covered ( @covered ) { |
|
63
|
|
|
|
|
|
|
# looks like a method |
|
64
|
1093
|
|
|
|
|
2631
|
$covered =~ s/.*->//; |
|
65
|
|
|
|
|
|
|
# looks fully qualified |
|
66
|
1093
|
|
|
|
|
2092
|
$covered =~ s/\A\w+(?:::\w+)*::(\w+)/$1/; |
|
67
|
|
|
|
|
|
|
# looks like it includes parameters |
|
68
|
1093
|
|
|
|
|
3714
|
$covered =~ s/(\w+)[;\(].*/$1/; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
501
|
|
|
|
|
3211
|
@covered = grep /\A\w+\z/, @covered; |
|
71
|
501
|
100
|
|
|
|
1656
|
if ($self->ignore_empty) { |
|
72
|
2
|
|
|
|
|
2
|
push @{ $me->{maybe_covered} }, @covered; |
|
|
2
|
|
|
|
|
5
|
|
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
else { |
|
75
|
499
|
|
|
|
|
3469
|
push @{ $me->{covered} }, |
|
76
|
499
|
|
|
|
|
868
|
grep !$me->{covered_hash}{$_}++, |
|
77
|
|
|
|
|
|
|
@covered; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
3009
|
|
|
|
|
7774
|
$self->SUPER::_handle_element_end(@_); |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub _handle_text { |
|
84
|
3433
|
|
|
3433
|
|
43712
|
my $self = shift; |
|
85
|
3433
|
|
|
|
|
5915
|
my $me = $self->{+__PACKAGE__}; |
|
86
|
3433
|
|
|
|
|
6656
|
my ($text) = @_; |
|
87
|
3433
|
|
|
|
|
6172
|
my $in = $me->{in}; |
|
88
|
3433
|
100
|
100
|
|
|
14742
|
if ($in && @$in && $in->[-1]{target} =~ /\APod::Coverage(?:::Trust(?:Me|Pod))?\z/) { |
|
|
|
100
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
89
|
11
|
|
|
|
|
120
|
for my $token ($text =~ /(\S+)/g) { |
|
90
|
12
|
|
|
|
|
28
|
my $re; |
|
91
|
12
|
100
|
|
|
|
59
|
if ($token eq '*EVERYTHING*') { |
|
92
|
1
|
|
|
|
|
5
|
$re = qr{.?}; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
else { |
|
95
|
11
|
|
|
|
|
31
|
$re = eval { qr{\A(?:$token)\z} }; |
|
|
11
|
|
|
|
|
274
|
|
|
96
|
11
|
50
|
|
|
|
49
|
if (!$re) { |
|
97
|
0
|
|
0
|
|
|
0
|
my $file = $self->{source_filename} || ''; |
|
98
|
0
|
|
0
|
|
|
0
|
my $line = $in->[-1]{start_line} || ''; |
|
99
|
0
|
|
|
|
|
0
|
croak "Error compiling Pod::Coverage regex /$token/ at $file line $line: $@"; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
} |
|
102
|
12
|
|
|
|
|
53
|
push @{ $me->{trusted} }, $re |
|
103
|
12
|
50
|
|
|
|
75
|
unless $me->{trusted_hash}{$re}++; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
elsif ($me->{consider}) { |
|
107
|
694
|
|
|
|
|
1866
|
$me->{consider_text} .= $text; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
elsif ($me->{maybe_covered}) { |
|
110
|
1
|
|
|
|
|
2
|
push @{ $me->{covered} }, |
|
111
|
|
|
|
|
|
|
grep !$me->{covered_hash}{$_}++, |
|
112
|
1
|
|
|
|
|
2
|
@{ delete $me->{maybe_covered} }; |
|
|
1
|
|
|
|
|
4
|
|
|
113
|
|
|
|
|
|
|
} |
|
114
|
3433
|
|
|
|
|
8327
|
$self->SUPER::_handle_text(@_); |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub links { |
|
118
|
11
|
|
|
11
|
1
|
25
|
my $self = shift; |
|
119
|
11
|
|
100
|
|
|
156
|
return $self->{+__PACKAGE__}{links} ||= []; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub trusted { |
|
123
|
29
|
|
|
29
|
1
|
61
|
my $self = shift; |
|
124
|
29
|
|
100
|
|
|
616
|
return $self->{+__PACKAGE__}{trusted} ||= []; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub covered { |
|
128
|
87
|
|
|
87
|
1
|
182
|
my $self = shift; |
|
129
|
87
|
|
100
|
|
|
1372
|
return $self->{+__PACKAGE__}{covered} ||= []; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
|
133
|
|
|
|
|
|
|
__END__ |