« blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/Core.pm
↑ Summary
blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/MooseXDeclare.pm »
| 1 | package Perl::PrereqScanner::NotQuiteLite::App; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 66 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 66 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 66 | ▶ | use File::Find; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 66 | ▶ | use File::Glob 'bsd_glob'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 66 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 66 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 66 | ▶ | use CPAN::Meta::Prereqs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 66 | ▶ | use CPAN::Meta::Requirements; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 66 | ▶ | use Perl::PrereqScanner::NotQuiteLite; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 66 | ▶ | use Perl::PrereqScanner::NotQuiteLite::Util::Prereqs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 66 | ▶ | use Parse::Distname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 66 | ▶ | use constant WIN32 => $^O eq 'MSWin32'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 66 | my %IsTestClassFamily = map {$_ => 1} qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | Test::Class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | Test::Class::Moose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | Test::Class::Most | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | Test::Class::Sugar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | Test::Classy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 50 | ▶ | my ($class, %opts) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=30 SCAR=36.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 50 | for my $key (keys %opts) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 245 | ▶ | next unless $key =~ /\-/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | (my $replaced_key = $key) =~ s/\-/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | $opts{$replaced_key} = $opts{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 50 | $opts{prereqs} = CPAN::Meta::Prereqs->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 50 | ▶ | $opts{parsers} = [':bundled'] unless defined $opts{parsers}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 50 | ▶ | $opts{recommends} = 0 unless defined $opts{recommends}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 50 | ▶ | $opts{suggests} = 0 unless defined $opts{suggests}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 50 | ▶ | $opts{base_dir} ||= File::Spec->curdir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{"base_dir"} ||= "File::Spec"->curdir
MC/DC0%0/2
$opts{"base_dir"} ||= "File::Spec"->curdir
$opts{"base_dir"}
"File::Spec"->curdir
Truth table33%1/3
A ||= B
A= $opts{"base_dir"}B= "File::Spec"->curdir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 50 | ▶ | $opts{cpanfile} = 1 if $opts{save_cpanfile}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 50 | ▶ | if ($opts{features} and ref $opts{features} ne 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opts{"features"} and ref $opts{"features"} ne "HASH"
MC/DC50%1/2
$opts{"features"} and ref $opts{"features"} ne "HASH"
$opts{"features"}
ref $opts{"features"} ne "HASH"
Truth table66%2/3
A and B
A= $opts{"features"}B= ref $opts{"features"} ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 12 | my @features; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 12 | ▶ | if (!ref $opts{features}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 10 | @features = split ';', $opts{features}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } elsif (ref $opts{features} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | @features = @{$opts{features}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 12 | my %map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 12 | for my $spec (@features) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 12 | my ($identifier, $description, $paths) = split ':', $spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 12 | my @paths = map { bsd_glob(File::Spec->catdir($opts{base_dir}, $_)) } split ',', $paths; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 12 | if (WIN32) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | s|\\|/|g for @paths; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 12 | $map{$identifier} = { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | description => $description, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | paths => \@paths, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 12 | $opts{features} = \%map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 50 | ▶ | if ($opts{ignore} and ref $opts{ignore} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opts{"ignore"} and ref $opts{"ignore"} eq "ARRAY"
MC/DC50%1/2
$opts{"ignore"} and ref $opts{"ignore"} eq "ARRAY"
$opts{"ignore"}
ref $opts{"ignore"} eq "ARRAY"
Truth table66%2/3
A and B
A= $opts{"ignore"}B= ref $opts{"ignore"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 2 | require Regexp::Trie; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | my $re = Regexp::Trie->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | for (@{$opts{ignore}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | s|\\|/|g if WIN32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | $re->add($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | ▶ | $opts{ignore_re} ||= $re->_regexp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{"ignore_re"} ||= $re->_regexp
MC/DC0%0/2
$opts{"ignore_re"} ||= $re->_regexp
$opts{"ignore_re"}
$re->_regexp
Truth table33%1/3
A ||= B
A= $opts{"ignore_re"}B= $re->_regexp
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 50 | ▶ | if ($opts{private} and ref $opts{private} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opts{"private"} and ref $opts{"private"} eq "ARRAY"
MC/DC50%1/2
$opts{"private"} and ref $opts{"private"} eq "ARRAY"
$opts{"private"}
ref $opts{"private"} eq "ARRAY"
Truth table66%2/3
A and B
A= $opts{"private"}B= ref $opts{"private"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | require Regexp::Trie; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | my $re = Regexp::Trie->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | for (@{$opts{private}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | $re->add($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | $opts{private_re} ||= $re->_regexp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{"private_re"} ||= $re->_regexp
MC/DC0%0/2
$opts{"private_re"} ||= $re->_regexp
$opts{"private_re"}
$re->_regexp
Truth table33%1/3
A ||= B
A= $opts{"private_re"}B= $re->_regexp
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 50 | ▶ | if ($opts{optional} and ref $opts{optional} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$opts{"optional"} and ref $opts{"optional"} eq "ARRAY"
MC/DC50%1/2
$opts{"optional"} and ref $opts{"optional"} eq "ARRAY"
$opts{"optional"}
ref $opts{"optional"} eq "ARRAY"
Truth table66%2/3
A and B
A= $opts{"optional"}B= ref $opts{"optional"} eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | require Regexp::Trie; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | my $re = Regexp::Trie->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | for (@{$opts{optional}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | s|\\|/|g if WIN32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 2 | $re->add($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | ▶ | $opts{optional_re} ||= $re->_regexp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{"optional_re"} ||= $re->_regexp
MC/DC0%0/2
$opts{"optional_re"} ||= $re->_regexp
$opts{"optional_re"}
$re->_regexp
Truth table33%1/3
A ||= B
A= $opts{"optional_re"}B= $re->_regexp
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 50 | ▶ | if ($opts{optional_re}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 3 | $opts{suggests} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 50 | ▶ | if (my $index_name = delete $opts{use_index}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my $index_package = "CPAN::Common::Index::$index_name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if (eval "require $index_package; 1") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | $opts{index} = $index_package->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 50 | ▶ | if ($opts{scan_also}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | $opts{libs} ||= delete $opts{scan_also}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts{"libs"} ||= delete $opts{"scan_also"}
MC/DC0%0/2
$opts{"libs"} ||= delete $opts{"scan_also"}
$opts{"libs"}
delete $opts{"scan_also"}
Truth table33%1/3
A ||= B
A= $opts{"libs"}B= delete $opts{"scan_also"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 50 | bless \%opts, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 50 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=24 SCAR=36.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 50 | ▶ | unless (@args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # for configure requires | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 50 | push @args, "Makefile.PL", "Build.PL"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # for test requires | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 50 | push @args, "t"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # for runtime requires; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 50 | ▶ | if ($self->{blib} and -d File::Spec->catdir($self->{base_dir}, 'blib')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"blib"} and -d "File::Spec"->catdir($self->{"base_dir"}, "blib")
MC/DC0%0/2
$self->{"blib"} and -d "File::Spec"->catdir($self->{"base_dir"}, "blib")
$self->{"blib"}
-d "File::Spec"->catdir($self->{"base_dir"}, "blib")
Truth table33%1/3
A and B
A= $self->{"blib"}B= -d "File::Spec"->catdir($self->{"base_dir"}, "blib")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | push @args, "blib/lib", "blib/bin", "blib/script"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 50 | push @args, "lib"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 50 | push @args, glob(File::Spec->catfile($self->{base_dir}, '*.pm')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 50 | push @args, "bin", "script", "scripts"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # extra libs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 50 | ▶ | push @args, map { bsd_glob(File::Spec->catdir($self->{base_dir}, $_)) } @{$self->{libs} || []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # for develop requires | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 50 | ▶ | push @args, "xt", "author" if $self->{develop}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 50 | ▶ | if ($self->{verbose}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | print STDERR "Scanning the following files/directories\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | print STDERR " $_\n" for sort @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 50 | for my $path (@args) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 396 | ▶ | my $item = File::Spec->file_name_is_absolute($path) ? $path : File::Spec->catfile($self->{base_dir}, $path); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 396 | ▶ | -d $item ? $self->_scan_dir($item) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | -f $item ? $self->_scan_file($item) : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # add test requirements by .pm files used in .t files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 50 | $self->_add_test_requires($self->{allow_test_pms}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 50 | $self->_exclude_local_modules; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 50 | ▶ | if ($self->{exclude_core}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 7 | $self->_exclude_core_prereqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 50 | ▶ | if ($self->{index}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $self->_dedupe_indexed_prereqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 50 | $self->_dedupe; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 50 | ▶ | if ($self->{print} or $self->{cpanfile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"print"} or $self->{"cpanfile"}
MC/DC100%2/2
$self->{"print"} or $self->{"cpanfile"}
$self->{"print"}
$self->{"cpanfile"}
Truth table100%3/3
A or B
A= $self->{"print"}B= $self->{"cpanfile"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 22 | ▶ | if ($self->{json}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | # TODO: feature support (how should we express it?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | eval { require JSON::PP } or die "requires JSON::PP"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | print JSON::PP->new->pretty(1)->canonical->encode($self->{prereqs}->as_string_hash); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } elsif ($self->{cpanfile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 22 | ▶ | eval { require Perl::PrereqScanner::NotQuiteLite::Util::CPANfile } or die "requires Module::CPANfile"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 22 | my $file = File::Spec->catfile($self->{base_dir}, "cpanfile"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 22 | my $cpanfile = Perl::PrereqScanner::NotQuiteLite::Util::CPANfile->load_and_merge($file, $self->{prereqs}, $self->{features}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 22 | ▶ | $self->_dedupe_indexed_prereqs($cpanfile->prereqs) if $self->{index}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 22 | ▶ | if ($self->{save_cpanfile}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 15 | $cpanfile->save($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } elsif ($self->{print}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 7 | print $cpanfile->to_string, "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 22 | return $cpanfile; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } elsif ($self->{print}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $self->_print_prereqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 28 | $self->{prereqs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub index { shift->{index} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | sub _print_prereqs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_print_prereqs: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $combined = CPAN::Meta::Requirements->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | for my $req ($self->_requirements) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $combined->add_requirements($req); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my $hash = $combined->as_string_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | for my $module (sort keys %$hash) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | next if $module eq 'perl'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | my $version = $hash->{$module} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$hash->{$module} || 0
MC/DC0%0/1
$hash->{$module} || 0
$hash->{$module}
Truth table0%0/2
A
A= $hash->{$module}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $version = qq{"$version"} unless $version =~ /^[0-9]+(?:\.[0-9]+)?$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | print $version eq '0' ? "$module\n" : "$module~$version\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | sub _requirements { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 63 | ▶ | my ($self, $prereqs) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_requirements: called CC=14 SCAR=26.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 63 | ▶ | $prereqs ||= $self->{prereqs}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$prereqs ||= $self->{"prereqs"}
MC/DC0%0/2
$prereqs ||= $self->{"prereqs"}
$prereqs
$self->{"prereqs"}
Truth table33%1/3
A ||= B
A= $prereqsB= $self->{"prereqs"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 63 | my @phases = qw/configure runtime build test/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 63 | ▶ | push @phases, 'develop' if $self->{develop}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 63 | ▶ | my @types = $self->{suggests} ? qw/requires recommends suggests/ : $self->{recommends} ? qw/requires recommends/ : qw/requires/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 63 | my @requirements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 63 | for my $phase (@phases) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 252 | for my $type (@types) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 700 | my $req = $prereqs->requirements_for($phase, $type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 700 | ▶ | next unless $req->required_modules; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 67 | push @requirements, $req; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 63 | ▶ | if ($self->{features}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 18 | ▶ | my @feature_prereqs = grep defined, map {$self->{features}{$_}{prereqs}} keys %{$self->{features} || {}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 18 | for my $feature_prereqs (@feature_prereqs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 15 | for my $phase (@phases) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 60 | for my $type (@types) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 180 | my $req = $feature_prereqs->requirements_for($phase, $type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 180 | ▶ | next unless $req->required_modules; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 18 | push @requirements, $req; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 63 | @requirements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | sub _exclude_local_modules { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 50 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_exclude_local_modules: called CC=10 SCAR=23.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 50 | ▶ | my @local_dirs = ("inc", @{$self->{libs} || []}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 50 | for my $dir (@local_dirs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 55 | my $local_dir = File::Spec->catdir($self->{base_dir}, $dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 55 | ▶ | next unless -d $local_dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | find({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | wanted => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 15 | ▶ | my $file = $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 15 | ▶ | return unless -f $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 6 | my $relpath = File::Spec->abs2rel($file, $local_dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 6 | ▶ | return unless $relpath =~ /\.pm$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 5 | my $module = $relpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 5 | $module =~ s!\.pm$!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 5 | $module =~ s![\\/]!::!g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 5 | $self->{possible_modules}{$module} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 5 | ▶ | $self->{possible_modules}{"inc::$module"} = 1 if $dir eq 'inc'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 5 | no_chdir => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | }, $local_dir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 50 | my $private_re = $self->{private_re}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 50 | for my $req ($self->_requirements) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 68 | for my $module ($req->required_modules) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 197 | ▶ | next unless $self->{possible_modules}{$module} or ($private_re and $module =~ /$private_re/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->{"possible_modules"}{$module} or $private_re and $module =~ /$private_re/
$private_re and $module =~ /$private_re/
MC/DC66%2/3
$self->{"possible_modules"}{$module} or $private_re and $module =~ /$private_re/
$self->{"possible_modules"}{$module}
$private_re
$module =~ /$private_re/
Truth table75%3/4
A or B and C
A= $self->{"possible_modules"}{$module}B= $private_reC= $module =~ /$private_re/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 9 | $req->clear_requirement($module); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 9 | ▶ | if ($self->{verbose}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | print STDERR " excluded $module (local)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | sub _exclude_core_prereqs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 7 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_exclude_core_prereqs: called CC=15 SCAR=27.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 7 | ▶ | eval { require Module::CoreList; Module::CoreList->VERSION('2.99') } or die "requires Module::CoreList 2.99"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 7 | ▶ | my $perl_version = $self->{perl_version} || $self->_find_used_perl_version || '5.008001'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%5/5
$self->{'perl_version'} || $self->_find_used_perl_version || '5.008001'
$self->{"perl_version"} or $self->_find_used_perl_version
MC/DC100%2/2
$self->{'perl_version'} || $self->_find_used_perl_version || '5.008001'
$self->{"perl_version"}
$self->_find_used_perl_version
Truth table100%3/3
A or B
A= $self->{"perl_version"}B= $self->_find_used_perl_version
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 7 | ▶ | if ($perl_version =~ /^v?5\.(0?[1-9][0-9]?)(?:\.([0-9]))?$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 1 | ▶ | $perl_version = sprintf '5.%03d%03d', $1, $2 || 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$2 || 0
MC/DC0%0/1
$2 || 0
$2
Truth table50%1/2
A
A= $2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 7 | ▶ | $perl_version = '5.008001' unless exists $Module::CoreList::version{$perl_version}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 7 | my %core_alias = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 'Getopt::Long::Parser' => 'Getopt::Long', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 'Tie::File::Cache' => 'Tie::File', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 'Tie::File::Heap' => 'Tie::File', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 'Tie::StdScalar' => 'Tie::Scalar', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 'Tie::StdArray' => 'Tie::Array', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 'Tie::StdHash' => 'Tie::Hash', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 'Tie::ExtraHash' => 'Tie::Hash', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 'Tie::RefHash::Nestable' => 'Tie::RefHash', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 7 | for my $req ($self->_requirements) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 9 | for my $module ($req->required_modules) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 30 | ▶ | $module = $core_alias{$module} if exists $core_alias{$module}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 30 | ▶ | if (Module::CoreList::is_core($module, undef, $perl_version) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
Module::CoreList::is_core($module, undef, $perl_version) and not Module::CoreList::deprecated_in($module, undef, $perl_version)
MC/DC50%1/2
Module::CoreList::is_core($module, undef, $perl_version) and not Module::CoreList::deprecated_in($module, undef, $perl_version)
Module::CoreList::is_core($module, undef, $perl_version)
not Module::CoreList::deprecated_in($module, undef, $perl_version)
Truth table66%2/3
A and not(B)
A= Module::CoreList::is_core($module, undef, $perl_version)B= not Module::CoreList::deprecated_in($module, undef, $perl_version)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | !Module::CoreList::deprecated_in($module, undef, $perl_version) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 22 | ▶ | next unless exists $Module::CoreList::version{$perl_version}{$module}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 22 | my $core_version = $Module::CoreList::version{$perl_version}{$module}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 22 | ▶ | next unless $req->accepts_module($module => $core_version); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 21 | $req->clear_requirement($module); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 21 | ▶ | if ($self->{verbose}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | print STDERR " excluded $module ($perl_version core)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | sub _find_used_perl_version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_used_perl_version: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 6 | my @perl_versions; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 6 | my $perl_requirements = CPAN::Meta::Requirements->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 6 | for my $req ($self->_requirements) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 8 | my $perl_req = $req->requirements_for_module('perl'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 8 | ▶ | $perl_requirements->add_string_requirement('perl', $perl_req) if $perl_req; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 6 | ▶ | return $perl_requirements->is_simple ? $perl_requirements->requirements_for_module('perl') : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | sub _add_test_requires { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 50 | ▶ | my ($self, $force) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_test_requires: called CC=15 SCAR=28.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 50 | ▶ | if (my $test_reqs = $self->{prereqs}->requirements_for('test', 'requires')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 50 | my @required_modules = $test_reqs->required_modules; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 50 | for my $module (@required_modules) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 13 | ▶ | $force = 1 if exists $IsTestClassFamily{$module}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 13 | ▶ | my $relpath = $self->{possible_modules}{$module} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 3 | ▶ | my $context = delete $self->{_test_pm}{$relpath} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 3 | $test_reqs->add_requirements($context->requires); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 3 | ▶ | if ($self->{recommends} or $self->{suggests}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"recommends"} or $self->{"suggests"}
MC/DC0%0/2
$self->{"recommends"} or $self->{"suggests"}
$self->{"recommends"}
$self->{"suggests"}
Truth table33%1/3
A or B
A= $self->{"recommends"}B= $self->{"suggests"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 3 | $self->{prereqs}->requirements_for('test', 'recommends')->add_requirements($context->recommends); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 3 | ▶ | if ($self->{suggests}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 3 | $self->{prereqs}->requirements_for('test', 'suggests')->add_requirements($context->suggests); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 50 | ▶ | if ($force) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 2 | ▶ | for my $context (values %{$self->{_test_pm} || {}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 2 | $test_reqs->add_requirements($context->requires); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 2 | ▶ | if ($self->{recommends} or $self->{suggests}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"recommends"} or $self->{"suggests"}
MC/DC0%0/2
$self->{"recommends"} or $self->{"suggests"}
$self->{"recommends"}
$self->{"suggests"}
Truth table33%1/3
A or B
A= $self->{"recommends"}B= $self->{"suggests"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 2 | $self->{prereqs}->requirements_for('test', 'recommends')->add_requirements($context->recommends); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 2 | ▶ | if ($self->{suggests}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 2 | $self->{prereqs}->requirements_for('test', 'suggests')->add_requirements($context->suggests); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | sub _dedupe { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 50 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dedupe: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 50 | my $prereqs = $self->{prereqs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 50 | ▶ | my %features = map {$_ => $self->{features}{$_}{prereqs}} keys %{$self->{features} || {}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 50 | dedupe_prereqs_and_features($prereqs, \%features); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | sub _get_uri { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | my ($self, $module) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_uri: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | $self->{uri_cache}{$module} ||= $self->__get_uri($module); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"uri_cache"}{$module} ||= $self->__get_uri($module)
MC/DC0%0/2
$self->{"uri_cache"}{$module} ||= $self->__get_uri($module)
$self->{"uri_cache"}{$module}
$self->__get_uri($module)
Truth table0%0/3
A ||= B
A= $self->{"uri_cache"}{$module}B= $self->__get_uri($module)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | sub __get_uri { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | my ($self, $module) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__get_uri: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | my $res = $self->{index}->search_packages({ package => $module }) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | ## ignore (non-dual) core modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | return if _dist_from_uri($res->{uri}) eq 'perl'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | return $res->{uri}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | sub _dist_from_uri { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | my $uri = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dist_from_uri: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $uri =~ s!^cpan:///\w+/!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | Parse::Distname->new($uri)->dist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | sub _dedupe_indexed_prereqs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | my ($self, $prereqs) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dedupe_indexed_prereqs: not called CC=20 SCAR=60.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | for my $req ($self->_requirements($prereqs)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my %uri_map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | for my $module ($req->required_modules) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | next if $module eq 'perl'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | my $uri = $self->_get_uri($module) or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | $uri_map{$uri}{$module} = $req->requirements_for_module($module); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | for my $uri (keys %uri_map) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | my @modules = keys %{$uri_map{$uri}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | next if @modules < 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | my @modules_without_version = grep {!$uri_map{$uri}{$_}} @modules; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | next unless @modules_without_version; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | # clear unversioned prereqs if a versioned prereq exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | if (@modules > @modules_without_version) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | $req->clear_requirement($_) for @modules_without_version; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # Replace with the main module if none is versioned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | my $dist = _dist_from_uri($uri); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | (my $main_module = $dist) =~ s/-/::/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | if ($self->_get_uri($main_module)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $req->add_minimum($main_module); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | for my $module (@modules_without_version) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | next if $main_module eq $module; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $req->clear_requirement($module); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | if ($self->{verbose}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | print STDERR " deduped $module (in favor of $main_module)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | # special case for distributions without a main module | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my %score; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | for my $module (@modules_without_version) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my $depth = $module =~ s/::/::/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | my $length = length $module; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | $score{$module} = join ".", ($depth || 0), $length; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$depth || 0
MC/DC0%0/1
$depth || 0
$depth
Truth table0%0/2
A
A= $depth
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | my $topmost = (sort {$score{$a} <=> $score{$b} or $a cmp $b} @modules_without_version)[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | for my $module (@modules_without_version) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | next if $topmost eq $module; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | $req->clear_requirement($module); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | if ($self->{verbose}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | print STDERR " deduped $module (in favor of $topmost)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | sub _scan_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 25 | ▶ | my ($self, $dir) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scan_dir: called CC=1 SCAR=0.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | find ({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | no_chdir => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | wanted => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 96 | ▶ | my $file = $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 96 | ▶ | return unless -f $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 46 | my $relpath = File::Spec->abs2rel($file, $self->{base_dir}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | return unless $relpath =~ /\.(?:pl|PL|pm|cgi|psgi|t)$/ or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | dirname($relpath) =~ m!\b(?:bin|scripts?)$! or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 46 | ▶ | ($self->{develop} and $relpath =~ /^(?:author)\b/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition22%2/9
$relpath =~ /\.(?:pl|PL|pm|cgi|psgi|t)$/ or dirname($relpath) =~ /\b(?:bin|scripts?)$/ or $self->{"develop"} and $relpath =~ /^(?:author)\b/
$relpath =~ /\.(?:pl|PL|pm|cgi|psgi|t)$/ or dirname($relpath) =~ /\b(?:bin|scripts?)$/
$self->{"develop"} and $relpath =~ /^(?:author)\b/
MC/DC0%0/4
$relpath =~ /\.(?:pl|PL|pm|cgi|psgi|t)$/ or dirname($relpath) =~ /\b(?:bin|scripts?)$/ or $self->{"develop"} and $relpath =~ /^(?:author)\b/
$relpath =~ /\.(?:pl|PL|pm|cgi|psgi|t)$/
dirname($relpath) =~ /\b(?:bin|scripts?)$/
$self->{"develop"}
$relpath =~ /^(?:author)\b/
Truth table20%1/5
A or B or C and D
A= $relpath =~ /\.(?:pl|PL|pm|cgi|psgi|t)$/B= dirname($relpath) =~ /\b(?:bin|scripts?)$/C= $self->{"develop"}D= $relpath =~ /^(?:author)\b/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 46 | $self->_scan_file($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 25 | }, $dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | sub _scan_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 86 | ▶ | my ($self, $file) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scan_file: called CC=16 SCAR=27.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 86 | $file =~ s|\\|/|g if WIN32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 86 | ▶ | if ($self->{ignore_re}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 6 | ▶ | return if $file =~ /\b$self->{ignore_re}\b/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 83 | ▶ | my $optional = $self->{optional_re} && $file =~ /\b$self->{optional_re}\b/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"optional_re"} and $file =~ /\b$self->{"optional_re"}\b/
MC/DC100%2/2
$self->{"optional_re"} and $file =~ /\b$self->{"optional_re"}\b/
$self->{"optional_re"}
$file =~ /\b$self->{"optional_re"}\b/
Truth table100%3/3
A and B
A= $self->{"optional_re"}B= $file =~ /\b$self->{"optional_re"}\b/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | my $context = Perl::PrereqScanner::NotQuiteLite->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | parsers => $self->{parsers}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | recommends => $self->{recommends}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | suggests => $self->{suggests}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | verbose => $self->{verbose}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 83 | optional => $optional, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | )->scan_file($file); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 83 | my $relpath = File::Spec->abs2rel($file, $self->{base_dir}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 83 | $relpath =~ s|\\|/|g if WIN32; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 83 | my $prereqs = $self->{prereqs}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 83 | ▶ | if ($self->{features}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 22 | for my $identifier (keys %{$self->{features}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 22 | my $feature = $self->{features}{$identifier}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 22 | ▶ | if (grep {$file =~ m!^$_(?:/|$)!} @{$feature->{paths}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 12 | ▶ | $prereqs = $feature->{prereqs} ||= CPAN::Meta::Prereqs->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$feature->{"prereqs"} ||= "CPAN::Meta::Prereqs"->new
MC/DC0%0/2
$feature->{"prereqs"} ||= "CPAN::Meta::Prereqs"->new
$feature->{"prereqs"}
"CPAN::Meta::Prereqs"->new
Truth table66%2/3
A ||= B
A= $feature->{"prereqs"}B= "CPAN::Meta::Prereqs"->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 12 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 83 | ▶ | if ($relpath =~ m!(?:^|[\\/])t[\\/]!) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 12 | ▶ | if ($relpath =~ /\.t$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 4 | $self->_add($prereqs, test => $context); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } elsif ($relpath =~ /\.pm$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 7 | $self->{_test_pm}{$relpath} = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } elsif ($relpath =~ m!(?:^|[\\/])(?:xt|inc|author)[\\/]!) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $self->_add($prereqs, develop => $context); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } elsif ($relpath =~ m!(?:(?:^|[\\/])Makefile|^Build)\.PL$!) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $self->_add($prereqs, configure => $context); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } elsif ($relpath =~ m!(?:^|[\\/])(?:.+)\.PL$!) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | $self->_add($prereqs, build => $context); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 71 | $self->_add($prereqs, runtime => $context); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 83 | ▶ | if ($relpath =~ /\.pm$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 78 | my $module = $relpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 78 | $module =~ s!\.pm$!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 78 | $module =~ s![\\/]!::!g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 78 | $self->{possible_modules}{$module} = $relpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 78 | $module =~ s!^(?:inc|blib|x?t)::!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 78 | $self->{possible_modules}{$module} = $relpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 78 | $module =~ s!^lib::!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 78 | $self->{possible_modules}{$module} = $relpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | sub _add { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 75 | ▶ | my ($self, $prereqs, $phase, $context) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 75 | $prereqs->requirements_for($phase, 'requires') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | ->add_requirements($context->requires); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 75 | ▶ | if ($self->{suggests} or $self->{recommends}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"suggests"} or $self->{"recommends"}
MC/DC50%1/2
$self->{"suggests"} or $self->{"recommends"}
$self->{"suggests"}
$self->{"recommends"}
Truth table66%2/3
A or B
A= $self->{"suggests"}B= $self->{"recommends"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 65 | $prereqs->requirements_for($phase, 'recommends') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | ->add_requirements($context->recommends); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 75 | ▶ | if ($self->{suggests}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 65 | $prereqs->requirements_for($phase, 'suggests') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | ->add_requirements($context->suggests); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 66 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||