blib/lib/Perl/PrereqScanner/Scanner/Superclass.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 6 / 6 Conditioncond 100% 11 / 11 MC/DCmcdc 100% 6 / 6 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 98.0% 51 / 52 CC 9 SCAR 19.5
CC
9
Cov
100%
scan_for_prereqs
9.0
BEGIN
1.0
BEGIN
1.0
CRAP 7.0
« blib/lib/Perl/PrereqScanner/Scanner/Perl5.pm ↑ Summary blib/lib/Perl/PrereqScanner/Scanner/POE.pm »
1 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Perl::PrereqScanner::Scanner::Superclass 1.100;
5 # ABSTRACT: scan for modules loaded with superclass.pm
6  
7 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 with 'Perl::PrereqScanner::Scanner';
9  
10 #pod =head1 DESCRIPTION
11 #pod
12 #pod This scanner will look for dependencies from the L<superclass> module:
13 #pod
14 #pod use superclass 'Foo', Bar => 1.23;
15 #pod
16 #pod =cut
17  
18 4 my $mod_re = qr/^[A-Z_a-z][0-9A-Z_a-z]*(?:(?:::|')[0-9A-Z_a-z]+)*$/;
19  
20 269 ▶sub scan_for_prereqs {
Subroutine scan_for_prereqs: called CC=9 SCAR=22.0
Pod undocumented
21 269 my ( $self, $ppi_doc, $req ) = @_;
22  
23 # regular use, require, and no
24 269 ▶ my $includes = $ppi_doc->find('Statement::Include') || [];
Condition100%2/2
$ppi_doc->find('Statement::Include') || []
l!l
137132
MC/DC100%1/1
$ppi_doc->find('Statement::Include') || []
$ppi_doc->find('Statement::Include')
Truth table100%2/2
A
A= $ppi_doc->find('Statement::Include')
Aresult
11
00
25 269 for my $node (@$includes) {
26 # inheritance
27 191 ▶ if ( $node->module eq 'superclass' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node->module eq "superclass") 27 164 191
28 # rt#55713: skip arguments like '-norequires', focus only on inheritance
29 my @meat = grep {
30 27 ▶ $_->isa('PPI::Token::QuoteLike::Words')
Condition100%6/6
$_->isa('PPI::Token::QuoteLike::Words') || $_->isa('PPI::Token::Quote') || $_->isa('PPI::Token::Number')
l!l&&r!l&&!r
36627
$_->isa("PPI::Token::QuoteLike::Words") or $_->isa("PPI::Token::Quote")
l!l&&r!l&&!r
63033
MC/DC100%3/3
$_->isa('PPI::Token::QuoteLike::Words') || $_->isa('PPI::Token::Quote') || $_->isa('PPI::Token::Number')
$_->isa("PPI::Token::QuoteLike::Words") $_->isa("PPI::Token::Quote") $_->isa('PPI::Token::Number')
Truth table100%4/4
A or B || C
A= $_->isa("PPI::Token::QuoteLike::Words")B= $_->isa("PPI::Token::Quote")C= $_->isa('PPI::Token::Number')
ABCresult
1XX1
01X1
0011
0000
31 || $_->isa('PPI::Token::Quote')
32 || $_->isa('PPI::Token::Number')
33 } $node->arguments;
34  
35 27 my @args = map { $self->_q_contents($_) } @meat;
36  
37 27 ▶ while (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 33 27 60
38 33 my $module = shift @args;
39 33 ▶ my $version = ( @args && $args[0] !~ $mod_re ) ? shift(@args) : 0;
Branch: 1 branch
BranchTrueFalseTotal
@args && !($args[0] =~ /$mod_re/) ? : 15 18 33
Condition100%3/3
@args and not $args[0] =~ /$mod_re/
!ll&&!rl&&r
15315
MC/DC100%2/2
@args and not $args[0] =~ /$mod_re/
@args not $args[0] =~ /$mod_re/
Truth table100%3/3
A and not(B)
A= @argsB= not $args[0] =~ /$mod_re/
ABresult
0X0
100
111
40 33 $req->add_minimum( $module => $version );
41 }
42 }
43 }
44 }
45  
46 4 1;
47  
48 __END__
« blib/lib/Perl/PrereqScanner/Scanner/Perl5.pm ↑ Summary blib/lib/Perl/PrereqScanner/Scanner/POE.pm »