Pod/Coverage/TrustMe.pm

filter: Statementstmt 98.1% 215 / 219 Branchbran 73.8% 65 / 88 Conditioncond 78.1% 43 / 55 MC/DCmcdc 54.5% 18 / 33 Subroutinesub 100% 39 / 39 Podpod 90.9% 10 / 11 totaltotal 87.6% 390 / 445 CC 68 SCAR 16.7
CC
68
Cov
89%
new
12.1
_search_packages
9.0
_pod_for
7.4
CRAP 5.3
« Pod/Coverage/TrustMe/Parser.pm ↑ Summary
1 package Pod::Coverage::TrustMe;
2 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 24 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 24 our $VERSION = '0.002002';
6 24 $VERSION =~ tr/_//d;
7  
8 24 ▶use Pod::Coverage::TrustMe::Parser;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 24 ▶use B ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 24 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 24 ▶use constant _GVf_IMPORTED_CV => defined &B::GVf_IMPORTED_CV ? B::GVf_IMPORTED_CV() : 0x80;
Subroutine BEGIN: called CC=2 SCAR=7.1
Branch: 1 branch
BranchTrueFalseTotal
defined &B::GVf_IMPORTED_CV ? : 24 0 24
12  
13 24 ▶use constant DEFAULT_PRIVATE => do {
Subroutine BEGIN: called CC=1 SCAR=0.0
14 24 my %s;
15 [
16 qr/\A_/,
17 # anything with non-word characters is not standard syntax, so exclude
18 # them. this includes overloads, which are internally stored as methods
19 # starting with '('.
20 qr/\W/,
21 24 (map qr{\A\Q$_\E\z}, grep !$s{$_}++, qw(
22 import
23 unimport
24 VERSION
25  
26 can
27 isa
28 does
29 DOES
30  
31 AUTOLOAD
32  
33 DESTROY
34 CLONE
35 CLONE_SKIP
36  
37 BUILD
38 BUILDALL
39 BUILDARGS
40 FOREIGNBUILDARGS
41 DEMOLISH
42 DEMOLISHALL
43  
44 bootstrap
45  
46 TIESCALAR
47 FETCH STORE
48  
49 TIEARRAY
50 FETCH STORE FETCHSIZE STORESIZE EXTEND EXISTS
51 DELETE CLEAR PUSH POP SHIFT UNSHIFT SPLICE
52  
53 TIEHASH
54 FETCH STORE DELETE CLEAR EXISTS FIRSTKEY NEXTKEY SCALAR
55  
56 TIEHANDLE
57 OPEN BINMODE FILENO SEEK TELL WRITE PRINT PRINTF
58 READ READLINE GETC EOF CLOSE
59  
60 UNTIE
61 )),
62 qr/\A
63 (?: MODIFY | FETCH )
64 _
65 (?: REF | SCALAR | ARRAY | HASH | CODE | GLOB | FORMAT | IO )
66 _
67 ATTRIBUTES
68 \z/x,
69 ];
70 24 };
71 24 &Internals::SvREADONLY(+DEFAULT_PRIVATE, 1);
72  
73 24 our $PACKAGE_RE = qr{
74 (?=[^0-9'])
75 (?:
76 ::
77 |
78 \w*
79 (?:'[^\W0-9]\w*)*
80 )*
81 }x;
82 24 &Internals::SvREADONLY(\$PACKAGE_RE, 1);
83  
84 24 my %ALIASES = (
85 nonwhitespace => 'require_content',
86 trustme => 'trust_methods',
87 );
88  
89 24 my %DEFAULTS = (
90 trust_roles => 1,
91 trust_parents => 1,
92 trust_pod => 1,
93 require_link => 0,
94 export_only => 0,
95 ignore_imported => 1,
96 require_content => 0,
97 trust_methods => [],
98 trust_packages => [],
99 private => DEFAULT_PRIVATE,
100 pod_from => undef,
101 package => undef,
102 );
103  
104 67 ▶sub new {
Subroutine new: called CC=12 SCAR=25.0
Pod undocumented
105 67 my ($class, %args) = @_;
106 67 ▶ $class = ref $class
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 67 67
107 if ref $class;
108  
109 67 for my $alias (sort keys %ALIASES) {
110 134 ▶ if (exists $args{$alias}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{$alias}) 4 130 134
111 4 my $to = $ALIASES{$alias};
112 4 ▶ if (exists $args{$to}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{$to}) 0 4 4
113 0 croak "$alias is an alias to $to, they can't both be specified!";
114 }
115 4 $args{$to} = delete $args{$alias};
116 }
117 }
118  
119 my $new = {
120 67 ▶ map +($_ => exists $args{$_} ? $args{$_} : $DEFAULTS{$_}), keys %DEFAULTS,
Branch: 1 branch
BranchTrueFalseTotal
exists $args{$_} ? : 86 718 804
121 };
122  
123 67 ▶ if (exists $args{private} || exists $args{also_private}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"private"} or exists $args{"also_private"}) 8 59 67
Condition100%3/3
exists $args{"private"} or exists $args{"also_private"}
l!l&&r!l&&!r
3559
MC/DC100%2/2
exists $args{"private"} or exists $args{"also_private"}
exists $args{"private"} exists $args{"also_private"}
Truth table100%3/3
A or B
A= exists $args{"private"}B= exists $args{"also_private"}
ABresult
1X1
011
000
124 $new->{private} = [
125 map +(ref $_ ? $_ : qr/\A\Q$_\E\z/), (
126 8 ▶ @{ $new->{private} },
Branch: 1 branch
BranchTrueFalseTotal
exists $args{'also_private'} ? : 5 3 8
127 8 ▶ exists $args{also_private} ? @{ $args{also_private} } : (),
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ? : 281 2 283
128 )
129 ];
130 }
131  
132 my $package = $new->{package}
133 67 ▶ or die "package is a required parameter";
Branch: 1 branch
BranchTrueFalseTotal
my $package = $new->{"package"} or die "package is a required parameter" 67 0 67
134  
135 67 ▶ eval { require(__pack_to_pm($package)); 1 } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { require (__pack_to_pm($package)); 1 } } or do { $new->{"why_unrated"} = "requiring '${package}' failed: $@"; $new->{"broken"} = 1 } 66 1 67
136 1 $new->{why_unrated} = "requiring '$package' failed: $@";
137 1 $new->{broken} = 1;
138 };
139  
140 67 bless $new, $class;
141 }
142  
143 508 ▶sub package {
Subroutine package: called CC=1 SCAR=0.0
Pod documented
144 508 my $self = shift;
145 508 $self->{package};
146 }
147  
148 84 ▶sub symbols {
Subroutine symbols: called CC=7 SCAR=19.5
Pod documented
149 84 my $self = shift;
150 return undef
151 84 ▶ if $self->{broken};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"broken"} 1 83 84
152 83 ▶ $self->{symbols} ||= do {
Condition66%2/3
$self->{"symbols"} ||= do { my $package = $self->package; my(%pods) = map(($_, 1), @{$self->_get_pods($package);}); my(%symbols) = map(($_, $pods{$_} || $self->_trust_method_check($_) || 0), $self->_get_syms($package)); unless (grep $_, values %symbols) { $self->{"why_unrated"} ||= "no public symbols defined"; } ; \%symbols }
l!l&&r!l&&!r
17660
MC/DC0%0/2
$self->{"symbols"} ||= do { my $package = $self->package; my(%pods) = map(($_, 1), @{$self->_get_pods($package);}); my(%symbols) = map(($_, $pods{$_} || $self->_trust_method_check($_) || 0), $self->_get_syms($package)); unless (grep $_, values %symbols) { $self->{"why_unrated"} ||= "no public symbols defined"; } ; \%symbols }
$self->{"symbols"} do { my $package = $self->package; my(%pods) = map(($_, 1), @{$self->_get_pods($package);}); my(%symbols) = map(($_, $pods{$_} || $self->_trust_method_check($_) || 0), $self->_get_syms($package)); unless (grep $_, values %symbols) { $self->{"why_unrated"} ||= "no public symbols defined"; } ; \%symbols }
Truth table66%2/3
A ||= B
A= $self->{"symbols"}B= do { my $package = $self->package; my(%pods) = map(($_, 1), @{$self->_get_pods($package);}); my(%symbols) = map(($_, $pods{$_} || $self->_trust_method_check($_) || 0), $self->_get_syms($package)); unless (grep $_, values %symbols) { $self->{"why_unrated"} ||= "no public symbols defined"; } ; \%symbols }
ABresult
1X1
011
000
153 66 my $package = $self->package;
154  
155 66 my %pods = map +( $_ => 1 ), @{ $self->_get_pods($package) };
156 my %symbols = map +(
157 66 ▶ $_ => ($pods{$_} || $self->_trust_method_check($_) || 0),
Condition100%5/5
$pods{$_} || $self->_trust_method_check($_) || 0
l!l
17133
$pods{$_} or $self->_trust_method_check($_)
l!l&&r!l&&!r
1551633
MC/DC100%2/2
$pods{$_} || $self->_trust_method_check($_) || 0
$pods{$_} $self->_trust_method_check($_)
Truth table100%3/3
A or B
A= $pods{$_}B= $self->_trust_method_check($_)
ABresult
1X1
011
000
158 ), $self->_get_syms($package);
159  
160 66 ▶ if (!grep $_, values %symbols) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep $_, values %symbols) 8 58 66
161 8 ▶ $self->{why_unrated} ||= "no public symbols defined";
Condition50%1/2
$self->{"why_unrated"} ||= "no public symbols defined"
l!l
08
MC/DC0%0/1
$self->{"why_unrated"} ||= "no public symbols defined"
$self->{"why_unrated"}
Truth table50%1/2
A
A= $self->{"why_unrated"}
Aresult
11
00
162 }
163  
164 66 \%symbols;
165 };
166 }
167  
168 70 ▶sub coverage {
Subroutine coverage: called CC=3 SCAR=11.0
Pod documented
169 70 my $self = shift;
170 70 ▶ my $symbols = $self->symbols
Branch: 1 branch
BranchTrueFalseTotal
my $symbols = $self->symbols or return undef 69 1 70
171 or return undef;
172  
173 69 ▶ my $total = scalar keys %$symbols
Branch: 1 branch
BranchTrueFalseTotal
my $total = scalar keys %$symbols or return undef 65 4 69
174 or return undef;
175 65 my $documented = scalar grep $_, values %$symbols;
176  
177 65 return $documented / $total;
178 }
179  
180 5 ▶sub why_unrated {
Subroutine why_unrated: called CC=1 SCAR=0.0
Pod documented
181 5 my $self = shift;
182 5 return $self->{why_unrated};
183 }
184  
185 11 ▶sub uncovered {
Subroutine uncovered: called CC=2 SCAR=7.0
Pod documented
186 11 my $self = shift;
187 11 ▶ my $symbols = $self->symbols
Branch: 1 branch
BranchTrueFalseTotal
my $symbols = $self->symbols or return () 11 0 11
188 or return ();
189 11 my @uncovered = sort grep !$symbols->{$_}, keys %$symbols;
190 11 return @uncovered;
191 }
192 6 ▶sub naked {
Subroutine naked: called CC=1 SCAR=0.0
Pod documented
193 6 my $self = shift;
194 6 return $self->uncovered(@_);
195 }
196  
197 2 ▶sub covered {
Subroutine covered: called CC=2 SCAR=7.0
Pod documented
198 2 my $self = shift;
199 2 ▶ my $symbols = $self->symbols
Branch: 1 branch
BranchTrueFalseTotal
my $symbols = $self->symbols or return () 2 0 2
200 or return ();
201 2 my @covered = sort grep $symbols->{$_}, keys %$symbols;
202 2 return @covered;
203 }
204  
205 2 ▶sub report {
Subroutine report: called CC=4 SCAR=14.0
Pod documented
206 2 my $self = shift;
207 2 my $rating = $self->coverage;
208  
209 2 ▶ $rating = 'unrated (' . $self->why_unrated . ')'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $rating 0 2 2
210 unless defined $rating;
211  
212 2 my $message = sprintf "%s has a Pod coverage rating of %s\n", $self->package, $rating;
213  
214 2 my @uncovered = $self->uncovered;
215 2 ▶ if (@uncovered) {
Branch: 1 branch
BranchTrueFalseTotal
if (@uncovered) 2 0 2
216 2 $message .= "The following are uncovered:\n";
217 $message .= " $_\n"
218 2 for @uncovered;
219 }
220 2 return $message;
221 }
222  
223 2 ▶sub print_report {
Subroutine print_report: called CC=1 SCAR=0.0
Pod documented
224 2 my $self = shift;
225 2 print $self->report;
226 }
227  
228 9 ▶sub import {
Subroutine import: called CC=3 SCAR=16.5
229 9 my $class = shift;
230 return
231 9 ▶ if !@_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 9 0 9
232  
233 0 ▶ $class->new(@_ == 1 ? (package => $_[0]) : @_)->print_report;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 0 0 0
234 0 return;
235 }
236  
237  
238 70 ▶sub _search_packages {
Subroutine _search_packages: called CC=9 SCAR=22.0
239 70 my $self = shift;
240 70 my @search = @_;
241 70 ▶ @search = ('main')
Branch: 1 branch
BranchTrueFalseTotal
unless @search 70 0 70
242 if !@search;
243  
244 s/\A(?:::)?(?:(?:main)?::)+//, s/(?:::)?\z/::/
245 70 for @search;
246  
247 70 my @packages;
248  
249 70 ▶ while (@search) {
Branch: 1 branch
BranchTrueFalseTotal
if (@search) 21450 70 21520
250 21450 my $search = shift @search;
251 21450 push @packages, $search;
252 21450 ▶ my $base = $search eq 'main::' ? '' : $search;
Branch: 1 branch
BranchTrueFalseTotal
$search eq 'main::' ? : 70 21380 21450
253  
254 24 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
255 21450 ▶ my @add =
Condition100%3/3
/::$/ && $_ ne 'main::'
!ll&&!rl&&r
4287487021380
MC/DC100%2/2
/::$/ && $_ ne 'main::'
/::$/ $_ ne 'main::'
Truth table100%3/3
A && B
A= /::$/B= $_ ne 'main::'
ABresult
0X0
100
111
256 map $base.$_,
257 sort
258 grep /::$/ && $_ ne 'main::',
259 keys %$search;
260  
261 21450 unshift @search, @add;
262 }
263  
264 s/::\z//
265 70 for @packages;
266  
267 70 ▶ return grep +(
Condition83%5/6
$_ ne 'main' && $_ ne '' && $_ ne 'UNIVERSAL'
!ll&&!rl&&r
707021310
$_ ne "main" and $_ ne ""
!ll&&!rl&&r
70021380
MC/DC66%2/3
$_ ne 'main' && $_ ne '' && $_ ne 'UNIVERSAL'
$_ ne "main" $_ ne "" $_ ne 'UNIVERSAL'
Truth table75%3/4
A and B && C
A= $_ ne "main"B= $_ ne ""C= $_ ne 'UNIVERSAL'
ABCresult
0XX0
10X0
1100
1111
268 $_ ne 'main'
269 && $_ ne ''
270 && $_ ne 'UNIVERSAL'
271 ), @packages;
272 }
273  
274 66 ▶sub _get_roles {
Subroutine _get_roles: called CC=6 SCAR=18.0
275 66 my $self = shift;
276 66 my $package = $self->package;
277 66 ▶ my $does
Branch: 2 branches
BranchTrueFalseTotal
$package->can('does') ? : 2 64 66
$package->can('DOES') ? : 64 0 64
278 = $package->can('does') ? 'does'
279 : $package->can('DOES') ? 'DOES'
280 : undef;
281 66 ▶ if (!$does || $package->can($does) == \&UNIVERSAL::DOES) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $does or $package->can($does) == \&UNIVERSAL::DOES) 62 4 66
Condition66%2/3
not $does or $package->can($does) == \&UNIVERSAL::DOES
l!l&&r!l&&!r
0624
MC/DC50%1/2
not $does or $package->can($does) == \&UNIVERSAL::DOES
not $does $package->can($does) == \&UNIVERSAL::DOES
Truth table66%2/3
not(A) or B
A= not $doesB= $package->can($does) == \&UNIVERSAL::DOES
ABresult
1X1
011
000
282 62 return;
283 }
284 4 ▶ return grep $_ ne $package && $package->$does($_), $self->_search_packages;
Condition100%3/3
$_ ne $package && $package->$does($_)
!ll&&!rl&&r
412672
MC/DC100%2/2
$_ ne $package && $package->$does($_)
$_ ne $package $package->$does($_)
Truth table100%3/3
A && B
A= $_ ne $packageB= $package->$does($_)
ABresult
0X0
100
111
285 }
286  
287 66 ▶sub _get_parents {
Subroutine _get_parents: called CC=2 SCAR=6.9
288 66 my $self = shift;
289 66 my $package = $self->package;
290 66 ▶ return grep $_ ne $package && $package->isa($_), $self->_search_packages;
Condition100%3/3
$_ ne $package && $package->isa($_)
!ll&&!rl&&r
661995516
MC/DC100%2/2
$_ ne $package && $package->isa($_)
$_ ne $package $package->isa($_)
Truth table100%3/3
A && B
A= $_ ne $packageB= $package->isa($_)
ABresult
0X0
100
111
291 }
292  
293 151 ▶sub __pack_to_pm {
Subroutine __pack_to_pm: called CC=2 SCAR=7.0
294 151 my ($package) = @_;
295 151 ▶ croak "Invalid package '$package'"
Branch: 1 branch
BranchTrueFalseTotal
unless $package =~ /\A$Pod::Coverage::TrustMe::PACKAGE_RE\z/ 0 151 151
296 unless $package =~ /\A$PACKAGE_RE\z/;
297 151 (my $mod = "$package.pm") =~ s{'|::}{/}g;
298 151 return $mod;
299 }
300  
301 84 ▶sub _pod_for {
Subroutine _pod_for: called CC=7 SCAR=20.1
302 84 my $self = shift;
303 84 my ($package) = @_;
304 84 ▶ if ($self->package eq $package && defined $self->{pod_from}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->package eq $package and defined $self->{"pod_from"}) 0 84 84
Condition66%2/3
$self->package eq $package and defined $self->{"pod_from"}
!ll&&!rl&&r
18660
MC/DC0%0/2
$self->package eq $package and defined $self->{"pod_from"}
$self->package eq $package defined $self->{"pod_from"}
Truth table66%2/3
A and B
A= $self->package eq $packageB= defined $self->{"pod_from"}
ABresult
0X0
100
111
305 0 return $self->{pod_from};
306 }
307  
308 84 my $mod = __pack_to_pm($package);
309 84 ▶ my $full = $INC{$mod} or return;
Branch: 1 branch
BranchTrueFalseTotal
my $full = $INC{$mod} or return 84 0 84
310 84 (my $maybe_pod = $full) =~ s{\.pm\z}{.pod};
311 84 ▶ my $pod
Branch: 2 branches
BranchTrueFalseTotal
-e $maybe_pod ? : 3 81 84
-e $full ? : 81 0 81
312 = -e $maybe_pod ? $maybe_pod
313 : -e $full ? $full
314 : undef
315 ;
316 84 ▶ if ($self->package eq $package) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->package eq $package) 66 18 84
317 66 $self->{pod_from} = $pod;
318 }
319 84 return $pod;
320 }
321  
322 66 ▶sub trusted_packages {
Subroutine trusted_packages: called CC=3 SCAR=11.3
Pod documented
323 66 my $self = shift;
324  
325 66 my %seen;
326 my @trusted = sort grep !$seen{$_}++,
327 $self->package,
328 66 ▶ @{ $self->{trust_packages} },
Branch: 2 branches
BranchTrueFalseTotal
$self->{'trust_roles'} ? : 66 0 66
$self->{'trust_parents'} ? : 66 0 66
329 ($self->{trust_roles} ? $self->_get_roles : ()),
330 66 ($self->{trust_parents} ? $self->_get_parents : ()),
331 ;
332  
333 66 return @trusted;
334 }
335  
336 84 ▶sub _pod_parser_class { 'Pod::Coverage::TrustMe::Parser' }
Subroutine _pod_parser_class: called CC=1 SCAR=0.0
337 84 ▶sub _new_pod_parser {
Subroutine _new_pod_parser: called CC=2 SCAR=6.9
338 84 my $self = shift;
339  
340 84 my $parser = $self->_pod_parser_class->new(@_);
341 84 ▶ if ($self->{require_content}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"require_content"}) 1 83 84
342 1 $parser->ignore_empty(1);
343 }
344 84 return $parser;
345 }
346 84 ▶sub _pod_parser_for {
Subroutine _pod_parser_for: called CC=2 SCAR=7.0
347 84 my $self = shift;
348 84 my ($pack) = @_;
349 84 ▶ my $pod = $self->_pod_for($pack)
Branch: 1 branch
BranchTrueFalseTotal
my $pod = $self->_pod_for($pack) or return undef 84 0 84
350 or return undef;
351 84 my $parser = $self->_new_pod_parser;
352 84 $parser->parse_file($pod);
353 84 return $parser;
354 }
355  
356 91 ▶sub _parsed {
Subroutine _parsed: called CC=7 SCAR=19.6
357 91 my $self = shift;
358 return $self->{_parsed}
359 91 ▶ if $self->{_parsed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"_parsed"} 25 66 91
360  
361 my %parsed = map {
362 66 my $pack = $_;
363 84 my $parser = $self->_pod_parser_for($pack);
364 84 ▶ $parser ? ($pack => $parser) : ();
Branch: 1 branch
BranchTrueFalseTotal
$parser ? : 84 0 84
365 } $self->trusted_packages;
366  
367 66 ▶ if ($self->{require_link}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"require_link"}) 8 58 66
368 8 my $package = $self->package;
369 8 my %allowed;
370 my %find_links = (
371 8 ▶ $package => delete $parsed{$package} || $self->_pod_parser_for($package),
Condition33%1/3
delete $parsed{$package} || $self->_pod_parser_for($package)
l!l&&r!l&&!r
800
MC/DC0%0/2
delete $parsed{$package} || $self->_pod_parser_for($package)
delete $parsed{$package} $self->_pod_parser_for($package)
Truth table33%1/3
A || B
A= delete $parsed{$package}B= $self->_pod_parser_for($package)
ABresult
1X1
011
000
372 );
373  
374 8 ▶ while (%find_links) {
Branch: 1 branch
BranchTrueFalseTotal
if (%find_links) 11 8 19
375 11 @allowed{keys %find_links} = values %find_links;
376 %find_links =
377 map +(exists $parsed{$_} ? ($_ => delete $parsed{$_}) : ()),
378 11 ▶ map @{ $_->links },
Branch: 1 branch
BranchTrueFalseTotal
exists $parsed{$_} ? : 3 0 3
379 values %find_links;
380 }
381  
382 8 %parsed = %allowed;
383 }
384  
385 66 $self->{_parsed} = \%parsed;
386 }
387  
388 66 ▶sub _symbols_for {
Subroutine _symbols_for: called CC=6 SCAR=17.9
389 66 my $self = shift;
390 66 my ($package) = @_;
391  
392 66 my @symbols;
393 24 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
394  
395 66 ▶ if ($self->{export_only}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'export_only'}) { } 1 65 66
396 @symbols = (
397 1 @{"${package}::EXPORT"},
398 1 @{"${package}::EXPORT_OK"},
399 );
400 }
401 else {
402 @symbols =
403 grep !(
404 $self->{ignore_imported} && $self->_imported_check($_)
405 or $self->_private_check($_)
406 ),
407 map {
408 329 my $sym = $_;
409 329 ▶ utf8::decode($sym)
Branch: 1 branch
BranchTrueFalseTotal
unless utf8::is_utf8($_) 326 3 329
410 if !utf8::is_utf8($_);
411 329 ▶ $sym;
Condition100%3/3
!/::\z/ && defined &{$package . '::' . $_;}
!ll&&!rl&&r
4403329
MC/DC100%2/2
!/::\z/ && defined &{$package . '::' . $_;}
!/::\z/ defined &{$package . '::' . $_;}
Truth table100%3/3
not(A) && B
A= !/::\z/B= defined &{$package . '::' . $_;}
ABresult
0X0
100
111
412 }
413 732 grep !/::\z/ && defined &{$package.'::'.$_},
414 65 ▶ keys %{$package.'::'};
Condition100%6/6
$self->{'ignore_imported'} && $self->_imported_check($_) || $self->_private_check($_)
l!l&&r!l&&!r
5123201
$self->{"ignore_imported"} and $self->_imported_check($_)
!ll&&!rl&&r
63185
MC/DC100%3/3
$self->{'ignore_imported'} && $self->_imported_check($_) || $self->_private_check($_)
$self->{"ignore_imported"} $self->_imported_check($_) $self->_private_check($_)
Truth table100%5/5
A and B || C
A= $self->{"ignore_imported"}B= $self->_imported_check($_)C= $self->_private_check($_)
ABCresult
11X1
0X11
1011
0X00
1000
415 }
416  
417 66 return @symbols;
418 }
419  
420 66 ▶sub _get_syms {
Subroutine _get_syms: called CC=2 SCAR=7.4
421 66 my $self = shift;
422 66 ▶ my $syms = $self->{_syms} ||= do {
Condition33%1/3
$self->{"_syms"} ||= do { [$self->_symbols_for($self->package)] }
l!l&&r!l&&!r
0660
MC/DC0%0/2
$self->{"_syms"} ||= do { [$self->_symbols_for($self->package)] }
$self->{"_syms"} do { [$self->_symbols_for($self->package)] }
Truth table33%1/3
A ||= B
A= $self->{"_syms"}B= do { [$self->_symbols_for($self->package)] }
ABresult
1X1
011
000
423 # recurse option?
424 66 [ $self->_symbols_for($self->package) ];
425 };
426 66 return @$syms;
427 }
428  
429 66 ▶sub _get_pods {
Subroutine _get_pods: called CC=2 SCAR=7.1
430 66 my $self = shift;
431  
432 66 ▶ $self->{_pods} ||= do {
Condition33%1/3
$self->{"_pods"} ||= do { my $parsed = $self->_parsed; my(%covered) = map(($_, 1), map(@{$_->covered;}, values %$parsed)); [sort(keys %covered)] }
l!l&&r!l&&!r
0660
MC/DC0%0/2
$self->{"_pods"} ||= do { my $parsed = $self->_parsed; my(%covered) = map(($_, 1), map(@{$_->covered;}, values %$parsed)); [sort(keys %covered)] }
$self->{"_pods"} do { my $parsed = $self->_parsed; my(%covered) = map(($_, 1), map(@{$_->covered;}, values %$parsed)); [sort(keys %covered)] }
Truth table33%1/3
A ||= B
A= $self->{"_pods"}B= do { my $parsed = $self->_parsed; my(%covered) = map(($_, 1), map(@{$_->covered;}, values %$parsed)); [sort(keys %covered)] }
ABresult
1X1
011
000
433 66 my $parsed = $self->_parsed;
434  
435 66 my %covered = map +( $_ => 1 ), map @{ $_->covered }, values %$parsed;
436  
437 66 [ sort keys %covered ];
438 };
439 }
440  
441 49 ▶sub _trusted_from_pod {
Subroutine _trusted_from_pod: called CC=2 SCAR=7.0
442 49 my $self = shift;
443  
444 49 ▶ $self->{_trusted_from_pod} ||= do {
Condition66%2/3
$self->{"_trusted_from_pod"} ||= do { my $parsed = $self->_parsed; [map(@{$_->trusted;}, values %$parsed)] }
l!l&&r!l&&!r
24250
MC/DC0%0/2
$self->{"_trusted_from_pod"} ||= do { my $parsed = $self->_parsed; [map(@{$_->trusted;}, values %$parsed)] }
$self->{"_trusted_from_pod"} do { my $parsed = $self->_parsed; [map(@{$_->trusted;}, values %$parsed)] }
Truth table66%2/3
A ||= B
A= $self->{"_trusted_from_pod"}B= do { my $parsed = $self->_parsed; [map(@{$_->trusted;}, values %$parsed)] }
ABresult
1X1
011
000
445 25 my $parsed = $self->_parsed;
446  
447 25 [ map @{ $_->trusted }, values %$parsed ];
448 };
449 }
450  
451 324 ▶sub _private_check {
Subroutine _private_check: called CC=1 SCAR=0.0
452 324 my $self = shift;
453 324 my ($sym) = @_;
454 324 return scalar grep $sym =~ /$_/, @{ $self->{private} };
455 }
456  
457 # providing _trustme_check and make overriding it work for compatibility with
458 # Pod::Coverage
459 49 ▶sub _trust_method_check {
Subroutine _trust_method_check: called CC=1 SCAR=0.0
460 49 my $self = shift;
461 49 $self->_trustme_check(@_);
462 }
463  
464 49 ▶sub _trustme_check {
Subroutine _trustme_check: called CC=2 SCAR=7.0
465 49 my $self = shift;
466 49 my ($sym) = @_;
467  
468 return scalar grep $sym =~ /$_/,
469 49 ▶ @{ $self->{trust_methods} },
Branch: 1 branch
BranchTrueFalseTotal
$self->{'trust_pod'} ? : 49 0 49
470 49 ($self->{trust_pod} ? @{ $self->_trusted_from_pod } : ());
471 }
472  
473 323 ▶sub _imported_check {
Subroutine _imported_check: called CC=1 SCAR=0.0
474 323 my $self = shift;
475 323 my ($sym) = @_;
476 323 my $package = $self->{package};
477 24 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
478 323 return !!(B::svref_2object(\*{$package.'::'.$sym})->GvFLAGS & _GVf_IMPORTED_CV);
479 }
480  
481 24 1;
482 __END__
« Pod/Coverage/TrustMe/Parser.pm ↑ Summary