« 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') || []
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')
| |||||||||||||||||||||||||||||||||||
| 25 | 269 | for my $node (@$includes) { | |||||||||||||||||||||||||||||||||
| 26 | # inheritance | ||||||||||||||||||||||||||||||||||
| 27 | 191 | ▶ | if ( $node->module eq 'superclass' ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 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')
$_->isa("PPI::Token::QuoteLike::Words") or $_->isa("PPI::Token::Quote")
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')
| |||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||
| 38 | 33 | my $module = shift @args; | |||||||||||||||||||||||||||||||||
| 39 | 33 | ▶ | my $version = ( @args && $args[0] !~ $mod_re ) ? shift(@args) : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args and not $args[0] =~ /$mod_re/
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/
| |||||||||||||||||||||||||||||||||||
| 40 | 33 | $req->add_minimum( $module => $version ); | |||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||
| 46 | 4 | 1; | |||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||
| 48 | __END__ | ||||||||||||||||||||||||||||||||||