| 1 | package Module::Install::Admin::ScanDeps; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 46 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 46 | ▶ | use Module::Install::Base (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 46 | ▶ | use vars qw{$VERSION @ISA}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 46 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 46 | $VERSION = '1.21'; | |||||||||||||||||||||||||||
| 8 | 46 | @ISA = qw(Module::Install::Base); | |||||||||||||||||||||||||||
| 9 | } | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub scan_dependencies { | ||||||||||||||||||||||||||
|
Subroutine
scan_dependencies: not called CC=24 SCAR=64.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 0 | my ($self, $pkg, $perl_version, $pkg_version) = @_; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | return if $pkg eq 'perl'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 0 | ▶ | $perl_version ||= $self->perl_version or die <<'END_MESSAGE'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$perl_version ||= $self->perl_version
MC/DC0%0/2
$perl_version ||= $self->perl_version
$perl_version
$self->perl_version
Truth table0%0/3
A ||= B
A= $perl_versionB= $self->perl_version
| |||||||||||||||||||||||||||||
| 17 | Please first specify a required perl version, like this: | ||||||||||||||||||||||||||||
| 18 | perl_version('5.005'); | ||||||||||||||||||||||||||||
| 19 | END_MESSAGE | ||||||||||||||||||||||||||||
| 20 | 0 | $perl_version =~ s{^(\d+)\.(\d+)\.(\d+)}{$1 + $2/1_000 + $3/1_000_000}e; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | require Module::ScanDeps; | |||||||||||||||||||||||||||
| 23 | 0 | require Module::CoreList; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | die "Module::CoreList has no information on perl $perl_version" | ||||||||||||||||||||||||||||
| 26 | 0 | ▶ | unless exists $Module::CoreList::version{$perl_version}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | if (my $min_version = Module::CoreList->first_release($pkg, $pkg_version)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | return if $min_version <= $perl_version; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | # We only need the first one in the @INC here | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $file = $self->admin->find_in_inc($pkg) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | or die "Cannot find $pkg in \@INC"; | ||||||||||||||||||||||||||||
| 35 | 0 | my %result = ($pkg => $file); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | my @files = ($file); | |||||||||||||||||||||||||||
| 38 | 0 | ▶ | while (@files) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 0 | my $deps = Module::ScanDeps::scan_deps( | |||||||||||||||||||||||||||
| 40 | files => \@files, | ||||||||||||||||||||||||||||
| 41 | recurse => 0, | ||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | @files = (); | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | foreach my $key (keys %$deps) { | |||||||||||||||||||||||||||
| 47 | 0 | ▶ | if ($deps->{$key}{type} eq 'shared') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | foreach my $used_by (@{$deps->{$key}{used_by}}) { | |||||||||||||||||||||||||||
| 49 | 0 | $used_by =~ s!/!::!g; | |||||||||||||||||||||||||||
| 50 | 0 | ▶ | $used_by =~ s!\.pm\Z!!i or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | next if exists $result{$used_by}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 0 | $result{$used_by} = undef; | |||||||||||||||||||||||||||
| 53 | 0 | my $min_version = Module::CoreList->first_release($used_by); | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | print "skipped $used_by (needs shared library)\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $min_version or $min_version <= $perl_version
MC/DC0%0/2
not $min_version or $min_version <= $perl_version
not $min_version
$min_version <= $perl_version
Truth table0%0/3
not(A) or B
A= not $min_versionB= $min_version <= $perl_version
| |||||||||||||||||||||||||||||
| 55 | unless !$min_version || $min_version <= $perl_version; | ||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | foreach my $key (keys %$deps) { | |||||||||||||||||||||||||||
| 61 | 0 | my $dep_pkg = $key; | |||||||||||||||||||||||||||
| 62 | 0 | $dep_pkg =~ s!/!::!g; | |||||||||||||||||||||||||||
| 63 | 0 | ▶ | $dep_pkg =~ s!\.pm\Z!!i or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if (my $min_version = Module::CoreList->first_release($dep_pkg)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | ▶ | next if $min_version <= $perl_version; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | 0 | ▶ | next if $dep_pkg =~ /^(?:DB|(?:Auto|Dyna|XS)Loader|threads|warnings)\b/i; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | next if exists $result{$dep_pkg}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | $result{$dep_pkg} = $deps->{$key}{file}; | |||||||||||||||||||||||||||
| 72 | 0 | push @files, $deps->{$key}{file}; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | while (my($k,$v) = each %result) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 0 | ▶ | delete $result{$k} unless defined $v; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | 0 | return \%result; | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 46 | 1; | |||||||||||||||||||||||||||