| 1 | package XS::Loader; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use Config(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use DynaLoader; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use XS::Install::Payload; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 11 | ▶ | use XS::Install::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 11 | our $UNIQUE_LIBNAME = ($^O eq 'MSWin32'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub load { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: not called CC=23 SCAR=61.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | shift if $_[0] && $_[0] eq __PACKAGE__; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$_[0] and $_[0] eq __PACKAGE__
MC/DC0%0/2
$_[0] and $_[0] eq __PACKAGE__
$_[0]
$_[0] eq __PACKAGE__
Truth table0%0/3
A and B
A= $_[0]B= $_[0] eq __PACKAGE__
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my ($module, $version, $flags, $noboot) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | $module ||= caller(0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$module ||= caller 0
MC/DC0%0/2
$module ||= caller 0
$module
caller 0
Truth table0%0/3
A ||= B
A= $moduleB= caller 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | $version ||= XS::Install::Payload::loaded_module_version($module); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$version ||= XS::Install::Payload::loaded_module_version($module)
MC/DC0%0/2
$version ||= XS::Install::Payload::loaded_module_version($module)
$version
XS::Install::Payload::loaded_module_version($module)
Truth table0%0/3
A ||= B
A= $versionB= XS::Install::Payload::loaded_module_version($module)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | $flags //= 0x01; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$flags //= 1
MC/DC0%0/1
$flags //= 1
$flags
Truth table0%0/2
A
A= $flags
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | $noboot = 1 if $module eq 'MyTest'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | if ($flags) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 11 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | *{"${module}::dl_load_flags"} = sub { $flags }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | if (my $info = XS::Install::Payload::binary_module_info($module)) {{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | my $bin_deps = $info->{BIN_DEPS} or last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | foreach my $dep_module (keys %$bin_deps) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | next if $dep_module eq 'XS::Install'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | my $path = $dep_module; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | $path =~ s!::!/!g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | require $path.".pm" or next; # in what cases it returns false without croaking? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $dep_version = XS::Install::Payload::loaded_module_version($dep_module); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | next if $dep_version eq $bin_deps->{$dep_module}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my $dep_info = XS::Install::Payload::binary_module_info($dep_module) || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
XS::Install::Payload::binary_module_info($dep_module) || {}
MC/DC0%0/1
XS::Install::Payload::binary_module_info($dep_module) || {}
XS::Install::Payload::binary_module_info($dep_module)
Truth table0%0/2
A
A= XS::Install::Payload::binary_module_info($dep_module)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $bin_dependent = $dep_info->{BIN_DEPENDENT}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | $bin_dependent = [$module] if !$bin_dependent or !@$bin_dependent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$bin_dependent and @$bin_dependent
MC/DC0%0/2
$bin_dependent and @$bin_dependent
$bin_dependent
@$bin_dependent
Truth table0%0/3
A and B
A= $bin_dependentB= @$bin_dependent
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | $bin_dependent = XS::Install::Util::linearize_dependent($bin_dependent); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | die << "EOF"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ****************************************************************************** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | XS::Loader: XS module $module binary depends on XS module $dep_module. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | $module was compiled with $dep_module version $bin_deps->{$dep_module}, but current version is $dep_version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | Please reinstall all modules that binary depend on $dep_module: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | cpanm --reinstall @$bin_dependent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ****************************************************************************** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | local *DynaLoader::mod2fname = \&mod2fname_unique if $UNIQUE_LIBNAME; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $ok = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | DynaLoader::bootstrap_inherit($module, $version); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | die($@) if !$ok and !($noboot and $@ and $@ =~ /Can't find 'boot_/i); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$ok or $noboot and $@ and $@ =~ /Can't find 'boot_/i
$noboot and $@ and $@ =~ /Can't find 'boot_/i
$noboot and $@
MC/DC0%0/4
$ok or $noboot and $@ and $@ =~ /Can't find 'boot_/i
$ok
$noboot
$@
$@ =~ /Can't find 'boot_/i
Truth table0%0/5
A or B and C and D
A= $okB= $nobootC= $@D= $@ =~ /Can't find 'boot_/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | if ($flags) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 11 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $stash = \%{"${module}::"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | delete $stash->{dl_load_flags}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub load_noboot { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_noboot: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | @_ = ($_[0], $_[1], $_[2], 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | goto &load; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 11 | *bootstrap = *load; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ############## taken from DynaLoader_pm.PL, needed on Windows ##################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub mod2fname_unique { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mod2fname_unique: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $parts = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my $so_len = length($Config::Config{dlext}) + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my $name_max = 255; # No easy way to get this here | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $libname = "PL_".join("__", @$parts); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | return $libname if (length($libname)+$so_len) <= $name_max; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # It's too darned big, so we need to go strip. We use the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # algorithm as xsubpp does. First, strip out doubled __ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $libname =~ s/__/_/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | return $libname if (length($libname)+$so_len) <= $name_max; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # Strip duplicate letters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | 1 while $libname =~ s/(.)\1/\U$1/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | return $libname if (length($libname)+$so_len) <= $name_max; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # Still too long. Truncate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $libname = substr($libname, 0, $name_max - $so_len); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | return $libname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||