/usr/local/lib/perl5/5.44.0/XSLoader.pm

filter: Statementstmt 13.0% 6 / 46 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 50.0% 2 / 4 Podpod 50.0% 1 / 2 totaltotal 11.2% 9 / 80 CC 13 SCAR 47.4
CC
13
Cov
9%
load
141.1
bootstrap_inherit
2.0
BEGIN
1.0
CRAP 114.9
« /usr/local/lib/perl5/5.44.0/x86_64-linux/IO/Socket.pm ↑ Summary /usr/local/lib/perl5/5.44.0/version.pm »
1 # Generated from XSLoader_pm.PL (resolved %Config::Config value)
2 # This file is unique for every OS
3  
4 use strict;
5 no strict 'refs';
6  
7 package XSLoader;
8  
9 our $VERSION = "0.32"; # remember to update version in POD!
10  
11 package DynaLoader;
12  
13 # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here.
14 # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB
15 boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) &&
16 !defined(&dl_error);
17 package XSLoader;
18  
19 sub load {
20 package DynaLoader;
21  
22 0 ▶ my ($caller, $modlibname) = caller();
Subroutine load: not called CC=13 SCAR=49.5
Pod documented
23 0 my $module = $caller;
24  
25 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
26 0 $module = $_[0];
27 } else {
28 0 $_[0] = $module;
29 }
30  
31 # work with static linking too
32 0 my $boots = "$module\::bootstrap";
33 0 ▶ goto &$boots if defined &$boots;
Branch: 1 branch
BranchTrueFalseTotal
if defined &$boots 0 0 0
34  
35 0 ▶ goto \&XSLoader::bootstrap_inherit unless $module and defined &dl_load_file;
Branch: 1 branch
BranchTrueFalseTotal
unless $module and defined &DynaLoader::dl_load_file 0 0 0
Condition0%0/3
$module and defined &DynaLoader::dl_load_file
!ll&&!rl&&r
000
MC/DC0%0/2
$module and defined &DynaLoader::dl_load_file
$module defined &DynaLoader::dl_load_file
Truth table0%0/3
A and B
A= $moduleB= defined &DynaLoader::dl_load_file
ABresult
0X0
100
111
36  
37 0 my @modparts = split(/::/,$module);
38 0 my $modfname = $modparts[-1];
39 0 my $modfname_orig = $modfname; # For .bs file search
40  
41 0 my $modpname = join('/',@modparts);
42 0 my $c = () = split(/::/,$caller,-1);
43 0 ▶ $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename
Branch: 1 branch
BranchTrueFalseTotal
$c-- and do { $modlibname =~ s[[\\/][^\\/]+$][] } 0 0 0
44 # Does this look like a relative path?
45 0 ▶ if ($modlibname !~ m{^/}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($modlibname =~ m[^/]) 0 0 0
46 # Someone may have a #line directive that changes the file name, or
47 # may be calling XSLoader::load from inside a string eval. We cer-
48 # tainly do not want to go loading some code that is not in @INC,
49 # as it could be untrusted.
50 #
51 # We could just fall back to DynaLoader here, but then the rest of
52 # this function would go untested in the perl core, since all @INC
53 # paths are relative during testing. That would be a time bomb
54 # waiting to happen, since bugs could be introduced into the code.
55 #
56 # So look through @INC to see if $modlibname is in it. A rela-
57 # tive $modlibname is not a common occurrence, so this block is
58 # not hot code.
59 FOUND: {
60 0 for (@INC) {
61 0 ▶ if ($_ eq $modlibname) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ eq $modlibname) 0 0 0
62 0 last FOUND;
63 }
64 }
65 # Not found. Fall back to DynaLoader.
66 0 goto \&XSLoader::bootstrap_inherit;
67 }
68 }
69 0 my $file = "$modlibname/auto/$modpname/$modfname.so";
70  
71 # print STDERR "XSLoader::load for $module ($file)\n" if $dl_debug;
72  
73 # N.B. The .bs file does not following the naming convention used
74 # by mod2fname, so use the unedited version of the name.
75  
76 0 my $bs = "$modlibname/auto/$modpname/$modfname_orig.bs";
77  
78 # This calls DynaLoader::bootstrap, which will load the .bs file if present
79 0 ▶ goto \&XSLoader::bootstrap_inherit if not -f $file or -s $bs;
Branch: 1 branch
BranchTrueFalseTotal
if not -f $file or -s $bs 0 0 0
Condition0%0/3
not -f $file or -s $bs
l!l&&r!l&&!r
000
MC/DC0%0/2
not -f $file or -s $bs
not -f $file -s $bs
Truth table0%0/3
not(A) or B
A= not -f $fileB= -s $bs
ABresult
1X1
011
000
80  
81 0 my $bootname = "boot_$module";
82 0 $bootname =~ s/\W/_/g;
83 0 @DynaLoader::dl_require_symbols = ($bootname);
84  
85 0 my $boot_symbol_ref;
86  
87 # Many dynamic extension loading problems will appear to come from
88 # this section of code: XYZ failed at line 123 of DynaLoader.pm.
89 # Often these errors are actually occurring in the initialisation
90 # C code of the extension XS file. Perl reports the error as being
91 # in this perl code simply because this was the last perl code
92 # it executed.
93  
94 0 ▶ my $libref = dl_load_file($file, 0) or do {
Branch: 1 branch
BranchTrueFalseTotal
my $libref = dl_load_file($file, 0) or do { require Carp; Carp::croak("Can't load '${file}' for module ${module}: " . dl_error()) } 0 0 0
95 0 require Carp;
96 0 Carp::croak("Can't load '$file' for module $module: " . dl_error());
97 };
98 0 push(@DynaLoader::dl_librefs,$libref); # record loaded object
99  
100 0 ▶ $boot_symbol_ref = dl_find_symbol($libref, $bootname) or do {
Branch: 1 branch
BranchTrueFalseTotal
$boot_symbol_ref = dl_find_symbol($libref, $bootname) or do { require Carp; Carp::croak("Can't find '${bootname}' symbol in $file\n") } 0 0 0
101 0 require Carp;
102 0 Carp::croak("Can't find '$bootname' symbol in $file\n");
103 };
104  
105 0 push(@DynaLoader::dl_modules, $module); # record loaded module
106  
107 0 boot:
108 my $xs = dl_install_xsub($boots, $boot_symbol_ref, $file);
109  
110 # See comment block above
111 0 push(@DynaLoader::dl_shared_objects, $file); # record files loaded
112 0 ▶ return &$xs(@_);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
113 }
114  
115 # Can't test with DynaLoader->can('bootstrap_inherit') when building in the
116 # core, as XSLoader gets built before DynaLoader.
117  
118 sub bootstrap_inherit {
119 0 ▶ require DynaLoader;
Subroutine bootstrap_inherit: not called CC=1 SCAR=6.9
Pod undocumented
120 0 goto \&DynaLoader::bootstrap_inherit;
121 }
122  
123 1;
124  
125 __END__
« /usr/local/lib/perl5/5.44.0/x86_64-linux/IO/Socket.pm ↑ Summary /usr/local/lib/perl5/5.44.0/version.pm »