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

filter: Statementstmt 100% 21 / 21 Branchbran 100% 4 / 4 Conditioncond 80.0% 4 / 5 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 92.1% 35 / 38 CC 6 SCAR 14.7
CC
6
Cov
97%
scan_for_prereqs
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.3
« blib/lib/Perl/PrereqScanner/Scanner/POE.pm ↑ Summary blib/lib/Perl/PrereqScanner/Scanner/TestMore.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::Aliased 1.100;
5 # ABSTRACT: scan for OO module aliases via aliased.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 aliased OO modules:
13 #pod
14 #pod use aliased 'Some::Long::Long::Name' => 'Short::Name';
15 #pod
16 #pod Short::Name->new;
17 #pod ...
18 #pod
19 #pod =cut
20  
21 269 ▶sub scan_for_prereqs {
Subroutine scan_for_prereqs: called CC=6 SCAR=17.9
Pod undocumented
22 269 my ($self, $ppi_doc, $req) = @_;
23  
24 # regular use and require
25 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
26 269 for my $node ( @$includes ) {
27 # aliasing
28 191 ▶ if (grep { $_ eq $node->module } qw{ aliased }) {
Branch: 1 branch
BranchTrueFalseTotal
if (grep {$_ eq $node->module;} "aliased") 12 179 191
29 # We only want the first argument to aliased
30 my @args = grep {
31 12 ▶ $_->isa('PPI::Token::QuoteLike::Words')
Condition66%2/3
$_->isa('PPI::Token::QuoteLike::Words') || $_->isa('PPI::Token::Quote')
l!l&&r!l&&!r
0123
MC/DC50%1/2
$_->isa('PPI::Token::QuoteLike::Words') || $_->isa('PPI::Token::Quote')
$_->isa('PPI::Token::QuoteLike::Words') $_->isa('PPI::Token::Quote')
Truth table66%2/3
A || B
A= $_->isa('PPI::Token::QuoteLike::Words')B= $_->isa('PPI::Token::Quote')
ABresult
1X1
011
000
32 || $_->isa('PPI::Token::Quote')
33 } $node->arguments;
34  
35 12 ▶ next unless @args;
Branch: 1 branch
BranchTrueFalseTotal
unless @args 3 9 12
36 9 my ($module) = $self->_q_contents($args[0]);
37 9 $req->add_minimum($module => 0);
38 }
39 }
40 }
41  
42 4 1;
43  
44 __END__
« blib/lib/Perl/PrereqScanner/Scanner/POE.pm ↑ Summary blib/lib/Perl/PrereqScanner/Scanner/TestMore.pm »