| 1 | package Carton; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use 5.008_005; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use version; our $VERSION = version->declare("v0.9.15"); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Cwd; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Config qw(%Config); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Carton::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use CPAN::Meta; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use CPAN::Meta::Requirements; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use File::Path (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use File::Temp (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use Capture::Tiny 'capture'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use Module::CPANfile; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use constant CARTON_LOCK_VERSION => '0.9'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | our $DefaultMirror = 'http://cpan.metacpan.org/'; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my($class, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 24 | bless { | ||||||||||||||||||||||||||||||||||||||||||
| 25 | path => $ENV{PERL_CARTON_PATH} || 'local', | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | mirror => $ENV{PERL_CARTON_MIRROR} || $DefaultMirror, | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$ENV{'PERL_CARTON_PATH'} || 'local'
$ENV{'PERL_CARTON_MIRROR'} || $Carton::DefaultMirror
MC/DC0%0/1
$ENV{'PERL_CARTON_PATH'} || 'local'
$ENV{'PERL_CARTON_PATH'}
MC/DC0%0/2
$ENV{'PERL_CARTON_MIRROR'} || $Carton::DefaultMirror
$ENV{'PERL_CARTON_MIRROR'}
$Carton::DefaultMirror
Truth table0%0/2
A
A= $ENV{'PERL_CARTON_PATH'}
Truth table0%0/3
A || B
A= $ENV{'PERL_CARTON_MIRROR'}B= $Carton::DefaultMirror
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub configure { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | %{$self} = (%$self, %args); | |||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | sub lock { $_[0]->{lock} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lock: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub local_mirror { File::Spec->rel2abs("$_[0]->{path}/cache") } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
local_mirror: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub install_from_cpanfile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_from_cpanfile: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | my($self, $file, $cascade) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my @modules = $self->list_dependencies; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | $self->install_conservative(\@modules, $cascade) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | or die "Installing modules failed\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub list_dependencies { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_dependencies: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $cpanfile = Module::CPANfile->load; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $prereq = $cpanfile->prereq; | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my $reqs = CPAN::Meta::Requirements->new; | |||||||||||||||||||||||||||||||||||||||||
| 54 | $reqs->add_requirements($prereq->requirements_for($_, 'requires')) | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | for qw( configure build runtime test ); | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my $hash = $reqs->as_string_hash; | |||||||||||||||||||||||||||||||||||||||||
| 58 | # TODO refactor to not rely on string representation | ||||||||||||||||||||||||||||||||||||||||||
| 59 | # TODO actually check 'perl' version | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | return map "$_~$hash->{$_}", grep { $_ ne 'perl' } keys %$hash; | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub dedupe_modules { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dedupe_modules: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my($self, $modules) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||
| 67 | my @result; | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | for my $spec (reverse @$modules) { | |||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my($mod, $ver) = split /~/, $spec; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | next if $seen{$mod}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | push @result, $spec; | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return [ reverse @result ]; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub download_from_cpanfile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
download_from_cpanfile: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my($self, $cpanfile, $local_mirror) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my @modules = $self->list_dependencies; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | my $modules = $self->dedupe_modules(\@modules); | |||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $index = $self->build_index($self->lock->{modules}); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $self->build_mirror_file($index, $self->{mirror_file}); | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | my $mirror = $self->{mirror} || $DefaultMirror; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'mirror'} || $Carton::DefaultMirror
MC/DC0%0/2
$self->{'mirror'} || $Carton::DefaultMirror
$self->{'mirror'}
$Carton::DefaultMirror
Truth table0%0/3
A || B
A= $self->{'mirror'}B= $Carton::DefaultMirror
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | local $self->{path} = File::Temp::tempdir(CLEANUP => 1); # ignore installed | |||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | $self->run_cpanm( | ||||||||||||||||||||||||||||||||||||||||||
| 92 | "--mirror", $mirror, | ||||||||||||||||||||||||||||||||||||||||||
| 93 | "--mirror", "http://backpan.perl.org/", # fallback | ||||||||||||||||||||||||||||||||||||||||||
| 94 | "--mirror-index", $self->{mirror_file}, | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | "--no-skip-satisfied", | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | ( $mirror ne $DefaultMirror ? "--mirror-only" : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 97 | "--scandeps", | ||||||||||||||||||||||||||||||||||||||||||
| 98 | "--save-dists", $local_mirror, | ||||||||||||||||||||||||||||||||||||||||||
| 99 | @$modules, | ||||||||||||||||||||||||||||||||||||||||||
| 100 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub install_conservative { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_conservative: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my($self, $modules, $cascade) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $modules = $self->dedupe_modules($modules); | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if ($self->lock) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | my $index = $self->build_index($self->lock->{modules}); | |||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $self->build_mirror_file($index, $self->{mirror_file}); | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | my $mirror = $self->{mirror} || $DefaultMirror; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'mirror'} || $Carton::DefaultMirror
MC/DC0%0/2
$self->{'mirror'} || $Carton::DefaultMirror
$self->{'mirror'}
$Carton::DefaultMirror
Truth table0%0/3
A || B
A= $self->{'mirror'}B= $Carton::DefaultMirror
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $is_default_mirror = 0; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if ( !ref $mirror ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | $is_default_mirror = $mirror eq $DefaultMirror ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $mirror = [split /,/, $mirror]; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | $self->run_cpanm( | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | (map { ("--mirror", $_) } @{$mirror}), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 123 | "--mirror", "http://backpan.perl.org/", # fallback | ||||||||||||||||||||||||||||||||||||||||||
| 124 | "--skip-satisfied", | ||||||||||||||||||||||||||||||||||||||||||
| 125 | ( $is_default_mirror ? () : "--mirror-only" ), | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ( $self->lock ? ("--mirror-index", $self->{mirror_file}) : () ), | |||||||||||||||||||||||||||||||||||||||||
| 127 | ( $cascade ? "--cascade-search" : () ), | ||||||||||||||||||||||||||||||||||||||||||
| 128 | @$modules, | ||||||||||||||||||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | sub build_mirror_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_mirror_file: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my($self, $index, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my @packages = $self->build_packages($index); | |||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | my $fh; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if ($file =~ /\.gz$/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | require IO::Compress::Gzip; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | $fh = IO::Compress::Gzip->new($file) or die $IO::Compress::Gzip::GzipError; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | open $fh, ">", $file or die $!; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | print $fh <<EOF; | |||||||||||||||||||||||||||||||||||||||||
| 146 | File: 02packages.details.txt | ||||||||||||||||||||||||||||||||||||||||||
| 147 | URL: http://www.perl.com/CPAN/modules/02packages.details.txt | ||||||||||||||||||||||||||||||||||||||||||
| 148 | Description: Package names found in carton.lock | ||||||||||||||||||||||||||||||||||||||||||
| 149 | Columns: package name, version, path | ||||||||||||||||||||||||||||||||||||||||||
| 150 | Intended-For: Automated fetch routines, namespace documentation. | ||||||||||||||||||||||||||||||||||||||||||
| 151 | Written-By: Carton $Carton::VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | Line-Count: @{[ scalar(@packages) ]} | |||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | Last-Updated: @{[ scalar localtime ]} | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | for my $p (@packages) { | |||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | print $fh sprintf "%s %s %s\n", pad($p->[0], 32), pad($p->[1] || 'undef', 10, 1), $p->[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$p->[1] || 'undef'
MC/DC0%0/1
$p->[1] || 'undef'
$p->[1]
Truth table0%0/2
A
A= $p->[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | return $file; | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub pad { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pad: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my($str, $len, $left) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my $howmany = $len - length($str); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | return $str if $howmany <= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $pad = " " x $howmany; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | return $left ? "$pad$str" : "$str$pad"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | sub build_packages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_packages: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my($self, $index) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my @packages; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | for my $package (sort keys %$index) { | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my $module = $index->{$package}; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | push @packages, [ $package, $module->{version}, $module->{meta}{pathname} ]; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | return @packages; | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | sub build_index { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_index: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my($self, $modules) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my $index; | |||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | while (my($name, $metadata) = each %$modules) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | for my $mod (keys %{$metadata->{provides}}) { | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $index->{$mod} = { %{$metadata->{provides}{$mod}}, meta => $metadata }; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | return $index; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | sub is_core { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_core: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | my($self, $module, $want_ver, $perl_version) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | $perl_version ||= $]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$perl_version ||= $]
MC/DC0%0/2
$perl_version ||= $]
$perl_version
$]
Truth table0%0/3
A ||= B
A= $perl_versionB= $]
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | require Module::CoreList; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | my $is_core = exists $Module::CoreList::version{$perl_version + 0}{$module} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | or return; | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my $core_ver = $Module::CoreList::version{$perl_version + 0}{$module}; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | return 1 unless $want_ver; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return version->new($core_ver) >= version->new($want_ver); | |||||||||||||||||||||||||||||||||||||||||
| 211 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | sub walk_down_tree { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
walk_down_tree: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | my($self, $tree, $cb, $no_warn) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my %seen; | |||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $tree->walk_down(sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my($node, $depth, $parent) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | return $tree->abort if $seen{$node->key}++; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | if ($node->metadata->{dist}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $cb->($node->metadata, $depth); | |||||||||||||||||||||||||||||||||||||||||
| 223 | ▶ | } elsif (!$self->is_core($node->key, 0) && !$no_warn) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->is_core($node->key, 0) || $no_warn
MC/DC0%0/2
$self->is_core($node->key, 0) || $no_warn
$self->is_core($node->key, 0)
$no_warn
Truth table0%0/3
A || B
A= $self->is_core($node->key, 0)B= $no_warn
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | warn "Couldn't find ", $node->key, "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub build_tree { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_tree: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my($self, $modules, $root) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | my $idx = $self->build_index($modules); | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $pool = { %$modules }; # copy | |||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $tree = Carton::Tree->new; | |||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | while (my $pick = (keys %$pool)[0]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $self->_build_tree($pick, $tree, $tree, $pool, $idx); | |||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | $tree->finalize($root); | |||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | return $tree; | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | sub _build_tree { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_tree: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my($self, $elem, $tree, $curr_node, $pool, $idx) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | if (my $cached = Carton::TreeNode->cached($elem)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $curr_node->add_child($cached); | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my $node = Carton::TreeNode->new($elem, $pool); | |||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $curr_node->add_child($node); | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | for my $child ( $self->build_deps($node->metadata, $idx) ) { | |||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $self->_build_tree($child, $tree, $node, $pool, $idx); | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | sub merge_prereqs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
merge_prereqs: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my($self, $prereqs) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my %requires; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | for my $phase (qw( configure build test runtime )) { | |||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | %requires = (%requires, %{$prereqs->{$phase}{requires} || {}}); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$prereqs->{$phase}{'requires'} || {}
MC/DC0%0/1
$prereqs->{$phase}{'requires'} || {}
$prereqs->{$phase}{'requires'}
Truth table0%0/2
A
A= $prereqs->{$phase}{'requires'}
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | return \%requires; | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | sub build_deps { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_deps: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my($self, $meta, $idx) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $requires = $self->merge_prereqs($meta->{mymeta}{prereqs}); | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | my @deps; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | for my $module (keys %$requires) { | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | next if $module eq 'perl'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | if (exists $idx->{$module}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | push @deps, $idx->{$module}{meta}{name}; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | push @deps, $module; | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | return @deps; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | sub run_cpanm_output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_cpanm_output: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | my $deps = capture { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | local $ENV{PERL_CPANM_OPT}; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | system "cpanm", "--quiet", "-L", $self->{path}, @args; | |||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my @deps = split $/, $deps; | |||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | return @deps; | |||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub run_cpanm { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_cpanm: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | local $ENV{PERL_CPANM_OPT}; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | !system "cpanm", "--quiet", "-L", $self->{path}, "--notest", @args; | |||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | sub update_lock_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_lock_file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my($self, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my $lock = $self->build_lock; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | Carton::Util::dump_json($lock, $file); | |||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | sub build_lock { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_lock: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | my %installs = $self->find_installs; | |||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||
| 323 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | modules => \%installs, | |||||||||||||||||||||||||||||||||||||||||
| 325 | version => CARTON_LOCK_VERSION, | ||||||||||||||||||||||||||||||||||||||||||
| 326 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | sub find_installs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_installs: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | require File::Find; | |||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my $libdir = "$self->{path}/lib/perl5/$Config{archname}/.meta"; | |||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | return unless -e $libdir; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my @installs; | |||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | my $wanted = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if ($_ eq 'install.json') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | push @installs, [ $File::Find::name, "$File::Find::dir/MYMETA.json" ]; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | File::Find::find($wanted, $libdir); | |||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | return map { | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | my $module = Carton::Util::load_json($_->[0]); | |||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | my $mymeta = -f $_->[1] ? CPAN::Meta->load_file($_->[1])->as_struct({ version => "2" }) : {}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ($module->{name} => { %$module, mymeta => $mymeta }) } @installs; | |||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | sub check_satisfies { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_satisfies: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my($self, $lock, $deps) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my @unsatisfied; | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $index = $self->build_index($lock->{modules}); | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my %pool = %{$lock->{modules}}; # copy | |||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | my @root = map { [ split /~/, $_, 2 ] } @$deps; | |||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | for my $dep (@root) { | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $self->_check_satisfies($dep, \@unsatisfied, $index, \%pool); | |||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | my $tree = keys %pool ? $self->build_tree(\%pool) : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | unsatisfied => \@unsatisfied, | |||||||||||||||||||||||||||||||||||||||||
| 368 | superflous => $tree, | ||||||||||||||||||||||||||||||||||||||||||
| 369 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | sub _check_satisfies { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_satisfies: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | my($self, $dep, $unsatisfied, $index, $pool) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my($mod, $ver) = @$dep; | |||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my $found = $index->{$mod}; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | if ($found) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | delete $pool->{$found->{meta}{name}}; | |||||||||||||||||||||||||||||||||||||||||
| 380 | } elsif ($self->is_core($mod, $ver)) { | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | unless ($found and (!$ver or version->new($found->{version}) >= version->new($ver))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$found and !$ver || "version"->new($found->{"version"}) >= "version"->new($ver)
not $ver or "version"->new($found->{"version"}) >= "version"->new($ver)
MC/DC0%0/3
$found and !$ver || "version"->new($found->{"version"}) >= "version"->new($ver)
$found
not $ver
"version"->new($found->{"version"}) >= "version"->new($ver)
Truth table0%0/4
A and not(B) or C
A= $foundB= not $verC= "version"->new($found->{"version"}) >= "version"->new($ver)
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | push @$unsatisfied, { | ||||||||||||||||||||||||||||||||||||||||||
| 386 | module => $mod, | ||||||||||||||||||||||||||||||||||||||||||
| 387 | version => $ver, | ||||||||||||||||||||||||||||||||||||||||||
| 388 | found => $found ? $found->{version} : undef, | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | my $requires = $self->merge_prereqs($found->{meta}{mymeta}{prereqs}); | |||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | for my $module (keys %$requires) { | |||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | next if $module eq 'perl'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $self->_check_satisfies([ $module, $requires->{$module} ], $unsatisfied, $index, $pool); | |||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | sub uninstall { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uninstall: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my($self, $lock, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my $meta = $lock->{modules}{$module}; | |||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | (my $path_name = $meta->{name}) =~ s!::!/!g; | |||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | my $path = Cwd::realpath($self->{path}); | |||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | my $packlist = "$path/lib/perl5/$Config{archname}/auto/$path_name/.packlist"; | |||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | open my $fh, "<", $packlist or die "Couldn't locate .packlist for $meta->{name}"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | # EUMM merges with site and perl library paths | ||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | next unless /^\Q$path\E/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | unlink $_ or warn "Couldn't unlink $_: $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | unlink $packlist; | |||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | if ($meta->{dist}) { # safety guard not to rm -r auto/meta | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | File::Path::rmtree("$self->{path}/lib/perl5/$Config{archname}/.meta/$meta->{dist}"); | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 424 | __END__ | ||||||||||||||||||||||||||||||||||||||||||