line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
1105
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
52
|
|
2
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
71
|
|
3
|
|
|
|
|
|
|
package Pod::Coverage::TrustPod 0.100006; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use base 'Pod::Coverage::CountParents'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
183
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: allow a module's pod to contain Pod::Coverage hints |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use Pod::Find qw(pod_where); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
85
|
|
9
|
2
|
|
|
2
|
|
716
|
use Pod::Eventual::Simple; |
|
2
|
|
|
|
|
46128
|
|
|
2
|
|
|
|
|
120
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod This is a Pod::Coverage subclass (actually, a subclass of |
14
|
|
|
|
|
|
|
#pod Pod::Coverage::CountParents) that allows the POD itself to declare certain |
15
|
|
|
|
|
|
|
#pod symbol names trusted. |
16
|
|
|
|
|
|
|
#pod |
17
|
|
|
|
|
|
|
#pod Here is a sample Perl module: |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod package Foo::Bar; |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod =head1 NAME |
22
|
|
|
|
|
|
|
#pod |
23
|
|
|
|
|
|
|
#pod Foo::Bar - a bar at which fooes like to drink |
24
|
|
|
|
|
|
|
#pod |
25
|
|
|
|
|
|
|
#pod =head1 METHODS |
26
|
|
|
|
|
|
|
#pod |
27
|
|
|
|
|
|
|
#pod =head2 fee |
28
|
|
|
|
|
|
|
#pod |
29
|
|
|
|
|
|
|
#pod returns the bar tab |
30
|
|
|
|
|
|
|
#pod |
31
|
|
|
|
|
|
|
#pod =cut |
32
|
|
|
|
|
|
|
#pod |
33
|
|
|
|
|
|
|
#pod sub fee { ... } |
34
|
|
|
|
|
|
|
#pod |
35
|
|
|
|
|
|
|
#pod =head2 fie |
36
|
|
|
|
|
|
|
#pod |
37
|
|
|
|
|
|
|
#pod scoffs at bar tab |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod =cut |
40
|
|
|
|
|
|
|
#pod |
41
|
|
|
|
|
|
|
#pod sub fie { ... } |
42
|
|
|
|
|
|
|
#pod |
43
|
|
|
|
|
|
|
#pod sub foo { ... } |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod =begin Pod::Coverage |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod foo |
48
|
|
|
|
|
|
|
#pod |
49
|
|
|
|
|
|
|
#pod =end Pod::Coverage |
50
|
|
|
|
|
|
|
#pod |
51
|
|
|
|
|
|
|
#pod =cut |
52
|
|
|
|
|
|
|
#pod |
53
|
|
|
|
|
|
|
#pod This file would report full coverage, because any non-empty lines inside a |
54
|
|
|
|
|
|
|
#pod block of POD targeted to Pod::Coverage are treated as C patterns. |
55
|
|
|
|
|
|
|
#pod Leading and trailing whitespace is stripped and the remainder is treated as a |
56
|
|
|
|
|
|
|
#pod regular expression anchored at both ends. |
57
|
|
|
|
|
|
|
#pod |
58
|
|
|
|
|
|
|
#pod Remember, anywhere you could use C<=begin> and C<=end> as above, you could |
59
|
|
|
|
|
|
|
#pod instead write: |
60
|
|
|
|
|
|
|
#pod |
61
|
|
|
|
|
|
|
#pod =for Pod::Coverage foo |
62
|
|
|
|
|
|
|
#pod |
63
|
|
|
|
|
|
|
#pod In some cases, you may wish to make the entire file trusted. The special |
64
|
|
|
|
|
|
|
#pod pattern C<*EVERYTHING*> may be provided to do just this. |
65
|
|
|
|
|
|
|
#pod |
66
|
|
|
|
|
|
|
#pod Keep in mind that Pod::Coverage::TrustPod sets up exceptions using the "trust" |
67
|
|
|
|
|
|
|
#pod mechanism rather than the "privacy" mechanism in Pod::Coverage. This is |
68
|
|
|
|
|
|
|
#pod unlikely ever to matter to you, but it's true. |
69
|
|
|
|
|
|
|
#pod |
70
|
|
|
|
|
|
|
#pod =cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub __get_pod_trust { |
73
|
7
|
|
|
7
|
|
17
|
my ($self, $package, $collect) = @_; |
74
|
|
|
|
|
|
|
|
75
|
7
|
|
|
|
|
10
|
my @parents; |
76
|
|
|
|
|
|
|
{ |
77
|
2
|
|
|
2
|
|
16
|
no strict 'refs'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
168
|
|
|
7
|
|
|
|
|
11
|
|
78
|
7
|
|
|
|
|
11
|
@parents = @{"$package\::ISA"}; |
|
7
|
|
|
|
|
27
|
|
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
7
|
100
|
|
|
|
1814
|
return $collect unless my $file = pod_where( { -inc => 1 }, $package ); |
82
|
|
|
|
|
|
|
|
83
|
6
|
|
|
|
|
63
|
my $output = Pod::Eventual::Simple->read_file($file); |
84
|
|
|
|
|
|
|
|
85
|
6
|
|
|
|
|
7856
|
my @hunks = grep {; |
86
|
2
|
|
|
2
|
|
13
|
no warnings 'uninitialized'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
952
|
|
87
|
|
|
|
|
|
|
((($_->{command} eq 'begin' and $_->{content} =~ /^Pod::Coverage\b/) |
88
|
|
|
|
|
|
|
... |
89
|
|
|
|
|
|
|
($_->{command} eq 'end' and $_->{content} =~ /^Pod::Coverage\b/)) |
90
|
|
|
|
|
|
|
and $_->{type} =~ m{\Averbatim|text\z}) |
91
|
|
|
|
|
|
|
or |
92
|
62
|
100
|
66
|
|
|
343
|
$_->{command} eq 'for' and $_->{content} =~ s/^Pod::Coverage\b// |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
93
|
|
|
|
|
|
|
} @$output; |
94
|
|
|
|
|
|
|
|
95
|
6
|
|
|
|
|
13
|
my @trusted; |
96
|
6
|
|
|
|
|
12
|
for my $hunk (@hunks) { |
97
|
5
|
50
|
|
|
|
14
|
my $line = defined $hunk->{start_line} ? $hunk->{start_link} : '?'; |
98
|
|
|
|
|
|
|
|
99
|
11
|
|
|
|
|
24
|
my @patterns = grep { s/^\s+//; s/\s+$//; /\S/ } |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
28
|
|
100
|
5
|
|
|
|
|
24
|
split /\s/m, $hunk->{content}; |
101
|
|
|
|
|
|
|
|
102
|
5
|
|
|
|
|
12
|
PATTERN: for my $pattern (@patterns) { |
103
|
6
|
|
|
|
|
8
|
my $qr; |
104
|
|
|
|
|
|
|
|
105
|
6
|
100
|
|
|
|
14
|
if ($pattern eq q{*EVERYTHING*}) { |
106
|
1
|
|
|
|
|
5
|
$collect->{$pattern} = qr{.?}; |
107
|
1
|
|
|
|
|
4
|
next PATTERN; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
5
|
|
|
|
|
8
|
my $ok = eval { $qr = qr{\A$pattern\z}; 1 }; |
|
5
|
|
|
|
|
81
|
|
|
5
|
|
|
|
|
13
|
|
111
|
5
|
50
|
|
|
|
12
|
Carp::croak("can't compile Pod::Coverage::TrustPod regex /$pattern/ at $file, line $line") |
112
|
|
|
|
|
|
|
unless $ok; |
113
|
|
|
|
|
|
|
|
114
|
5
|
|
|
|
|
18
|
$collect->{$pattern} = $qr; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
6
|
|
|
|
|
42
|
$self->__get_pod_trust($_, $collect) for @parents; |
119
|
|
|
|
|
|
|
|
120
|
6
|
|
|
|
|
49
|
return $collect; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub _trustme_check { |
124
|
19
|
|
|
19
|
|
19771
|
my ($self, $sym) = @_; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
my $from_pod = $self->{_trust_from_pod} ||= $self->__get_pod_trust( |
127
|
|
|
|
|
|
|
$self->{package}, |
128
|
|
|
|
|
|
|
{} |
129
|
19
|
|
66
|
|
|
67
|
); |
130
|
|
|
|
|
|
|
|
131
|
19
|
100
|
|
|
|
161
|
return 1 if $self->SUPER::_trustme_check($sym); |
132
|
16
|
100
|
|
|
|
44
|
return 1 if grep { $sym =~ $_ } values %$from_pod; |
|
16
|
|
|
|
|
130
|
|
133
|
|
|
|
|
|
|
|
134
|
7
|
|
|
|
|
49
|
return; |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |