| 1 | |||||||||||||||||||||||||||||||||
| 2 | # Generated from DynaLoader_pm.PL, this file is unique for every OS | ||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||
| 4 | use strict; | ||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | package DynaLoader; | ||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | # And Gandalf said: 'Many folk like to know beforehand what is to | ||||||||||||||||||||||||||||||||
| 9 | # be set on the table; but those who have laboured to prepare the | ||||||||||||||||||||||||||||||||
| 10 | # feast like to keep their secret; for wonder makes the words of | ||||||||||||||||||||||||||||||||
| 11 | # praise louder.' | ||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | # (Quote from Tolkien suggested by Anno Siegel.) | ||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||
| 15 | # See pod text at end of file for documentation. | ||||||||||||||||||||||||||||||||
| 16 | # See also ext/DynaLoader/README in source tree for other information. | ||||||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||||||
| 18 | # Tim.Bunce@ig.co.uk, August 1994 | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | BEGIN { | ||||||||||||||||||||||||||||||||
| 21 | our $VERSION = '1.57'; | ||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | # Note: in almost any other piece of code "our" would have been a better | ||||||||||||||||||||||||||||||||
| 25 | # option than "use vars", but DynaLoader's bootstrap files need the | ||||||||||||||||||||||||||||||||
| 26 | # side effect of the variable being declared in any scope whose current | ||||||||||||||||||||||||||||||||
| 27 | # package is DynaLoader, not just the current lexical one. | ||||||||||||||||||||||||||||||||
| 28 | use vars qw(@dl_library_path @dl_resolve_using @dl_require_symbols | ||||||||||||||||||||||||||||||||
| 29 | $dl_debug @dl_librefs @dl_modules @dl_shared_objects | ||||||||||||||||||||||||||||||||
| 30 | $dl_dlext $dl_so $dlsrc @args $module @dirs $file $bscode); | ||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | use Config; | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | # enable debug/trace messages from DynaLoader perl code | ||||||||||||||||||||||||||||||||
| 35 | $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug; | ||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | # | ||||||||||||||||||||||||||||||||
| 38 | # Flags to alter dl_load_file behaviour. Assigned bits: | ||||||||||||||||||||||||||||||||
| 39 | # 0x01 make symbols available for linking later dl_load_file's. | ||||||||||||||||||||||||||||||||
| 40 | # (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL)) | ||||||||||||||||||||||||||||||||
| 41 | # (ignored under VMS; effect is built-in to image linking) | ||||||||||||||||||||||||||||||||
| 42 | # (ignored under Android; the linker always uses RTLD_LOCAL) | ||||||||||||||||||||||||||||||||
| 43 | # | ||||||||||||||||||||||||||||||||
| 44 | # This is called as a class method $module->dl_load_flags. The | ||||||||||||||||||||||||||||||||
| 45 | # definition here will be inherited and result on "default" loading | ||||||||||||||||||||||||||||||||
| 46 | # behaviour unless a sub-class of DynaLoader defines its own version. | ||||||||||||||||||||||||||||||||
| 47 | # | ||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub dl_load_flags { 0x00 } | ||||||||||||||||||||||||||||||
|
Subroutine
dl_load_flags: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | ($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)}; | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | # Some systems need special handling to expand file specifications | ||||||||||||||||||||||||||||||||
| 54 | # (VMS support by Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>) | ||||||||||||||||||||||||||||||||
| 55 | # See dl_expandspec() for more details. Should be harmless but | ||||||||||||||||||||||||||||||||
| 56 | # inefficient to define on systems that don't need it. | ||||||||||||||||||||||||||||||||
| 57 | my $do_expand = 0; | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | @dl_require_symbols = (); # names of symbols we need | ||||||||||||||||||||||||||||||||
| 60 | @dl_library_path = (); # path to look for files | ||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | #XSLoader.pm may have added elements before we were required | ||||||||||||||||||||||||||||||||
| 63 | #@dl_shared_objects = (); # shared objects for symbols we have | ||||||||||||||||||||||||||||||||
| 64 | #@dl_librefs = (); # things we have loaded | ||||||||||||||||||||||||||||||||
| 65 | #@dl_modules = (); # Modules we have loaded | ||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | # Initialise @dl_library_path with the 'standard' library path | ||||||||||||||||||||||||||||||||
| 68 | # for this platform as determined by Configure. | ||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | push(@dl_library_path, split(' ', $Config::Config{libpth})); | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||
| 73 | my $ldlibpthname = $Config::Config{ldlibpthname}; | ||||||||||||||||||||||||||||||||
| 74 | my $ldlibpthname_defined = defined $Config::Config{ldlibpthname}; | ||||||||||||||||||||||||||||||||
| 75 | my $pthsep = $Config::Config{path_sep}; | ||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||
| 77 | # Add to @dl_library_path any extra directories we can gather from environment | ||||||||||||||||||||||||||||||||
| 78 | # during runtime. | ||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | if ($ldlibpthname_defined && | ||||||||||||||||||||||||||||||||
| 81 | exists $ENV{$ldlibpthname}) { | ||||||||||||||||||||||||||||||||
| 82 | push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname})); | ||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | # E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH. | ||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | if ($ldlibpthname_defined && | ||||||||||||||||||||||||||||||||
| 88 | $ldlibpthname ne 'LD_LIBRARY_PATH' && | ||||||||||||||||||||||||||||||||
| 89 | exists $ENV{LD_LIBRARY_PATH}) { | ||||||||||||||||||||||||||||||||
| 90 | push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH})); | ||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||
| 94 | # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here. | ||||||||||||||||||||||||||||||||
| 95 | # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB | ||||||||||||||||||||||||||||||||
| 96 | boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && | ||||||||||||||||||||||||||||||||
| 97 | !defined(&dl_error); | ||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||
| 99 | if ($dl_debug) { | ||||||||||||||||||||||||||||||||
| 100 | print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n"; | ||||||||||||||||||||||||||||||||
| 101 | print STDERR "DynaLoader not linked into this perl\n" | ||||||||||||||||||||||||||||||||
| 102 | unless defined(&boot_DynaLoader); | ||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||
| 105 | 1; # End of main code | ||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub croak { require Carp; Carp::croak(@_) } | ||||||||||||||||||||||||||||||
|
Subroutine
croak: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | sub bootstrap_inherit { | ||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $module = $_[0]; | ||||||||||||||||||||||||||||||
|
Subroutine
bootstrap_inherit: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||
| 113 | no strict qw/refs vars/; | ||||||||||||||||||||||||||||||||
| 114 | 0 | local *isa = *{"$module\::ISA"}; | |||||||||||||||||||||||||||||||
| 115 | 0 | local @isa = (@isa, 'DynaLoader'); | |||||||||||||||||||||||||||||||
| 116 | # Cannot goto due to delocalization. Will report errors on a wrong line? | ||||||||||||||||||||||||||||||||
| 117 | 0 | bootstrap(@_); | |||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||
| 120 | sub bootstrap { | ||||||||||||||||||||||||||||||||
| 121 | # use local vars to enable $module.bs script to edit values | ||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | local(@args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
bootstrap: not called CC=17 SCAR=57.2
| |||||||||||||||||||||||||||||||||
| 123 | 0 | local($module) = $args[0]; | |||||||||||||||||||||||||||||||
| 124 | 0 | local(@dirs, $file); | |||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | unless ($module) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 127 | 0 | require Carp; | |||||||||||||||||||||||||||||||
| 128 | 0 | Carp::confess("Usage: DynaLoader::bootstrap(module)"); | |||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||
| 131 | # A common error on platforms which don't support dynamic loading. | ||||||||||||||||||||||||||||||||
| 132 | # Since it's fatal and potentially confusing we give a detailed message. | ||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | croak("Can't load module $module, dynamic loading not available in this perl.\n". | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 134 | " (You may need to build a new perl executable which either supports\n". | ||||||||||||||||||||||||||||||||
| 135 | " dynamic loading or has the $module module statically linked into it.)\n") | ||||||||||||||||||||||||||||||||
| 136 | unless defined(&dl_load_file); | ||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||
| 140 | 0 | my @modparts = split(/::/,$module); | |||||||||||||||||||||||||||||||
| 141 | 0 | my $modfname = $modparts[-1]; | |||||||||||||||||||||||||||||||
| 142 | 0 | my $modfname_orig = $modfname; # For .bs file search | |||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||
| 144 | # Some systems have restrictions on files names for DLL's etc. | ||||||||||||||||||||||||||||||||
| 145 | # mod2fname returns appropriate file base name (typically truncated) | ||||||||||||||||||||||||||||||||
| 146 | # It may also edit @modparts if required. | ||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | $modfname = &mod2fname(\@modparts) if defined &mod2fname; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||
| 149 | 0 | my $modpname = join('/',@modparts); | |||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | print STDERR "DynaLoader::bootstrap for $module ", | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 152 | "(auto/$modpname/$modfname.$dl_dlext)\n" | ||||||||||||||||||||||||||||||||
| 153 | if $dl_debug; | ||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||
| 155 | 0 | my $dir; | |||||||||||||||||||||||||||||||
| 156 | 0 | foreach (@INC) { | |||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||
| 158 | 0 | $dir = "$_/auto/$modpname"; | |||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | next unless -d $dir; # skip over uninteresting directories | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||
| 162 | # check for common cases to avoid autoload of dl_findfile | ||||||||||||||||||||||||||||||||
| 163 | 0 | my $try = "$dir/$modfname.$dl_dlext"; | |||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try); | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
-f $try and $try
MC/DC0%0/2
-f $try and $try
-f $try
$try
Truth table0%0/3
A and B
A= -f $tryB= $try
| |||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||
| 166 | # no luck here, save dir for possible later dl_findfile search | ||||||||||||||||||||||||||||||||
| 167 | 0 | push @dirs, $dir; | |||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||
| 169 | # last resort, let dl_findfile have a go in all known locations | ||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)") | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 173 | unless $file; # wording similar to error from 'require' | ||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||
| 176 | 0 | my $bootname = "boot_$module"; | |||||||||||||||||||||||||||||||
| 177 | 0 | $bootname =~ s/\W/_/g; | |||||||||||||||||||||||||||||||
| 178 | 0 | @dl_require_symbols = ($bootname); | |||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||
| 180 | # Execute optional '.bootstrap' perl script for this module. | ||||||||||||||||||||||||||||||||
| 181 | # The .bs file can be used to configure @dl_resolve_using etc to | ||||||||||||||||||||||||||||||||
| 182 | # match the needs of the individual module on this architecture. | ||||||||||||||||||||||||||||||||
| 183 | # N.B. The .bs file does not following the naming convention used | ||||||||||||||||||||||||||||||||
| 184 | # by mod2fname. | ||||||||||||||||||||||||||||||||
| 185 | 0 | my $bs = "$dir/$modfname_orig"; | |||||||||||||||||||||||||||||||
| 186 | 0 | $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library | |||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | if (-s $bs) { # only read file if it's not empty | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 189 | 0 | eval { local @INC = ('.'); do $bs; }; | |||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | warn "$bs: $@\n" if $@; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||
| 193 | 0 | my $boot_symbol_ref; | |||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||
| 197 | # Many dynamic extension loading problems will appear to come from | ||||||||||||||||||||||||||||||||
| 198 | # this section of code: XYZ failed at line 123 of DynaLoader.pm. | ||||||||||||||||||||||||||||||||
| 199 | # Often these errors are actually occurring in the initialisation | ||||||||||||||||||||||||||||||||
| 200 | # C code of the extension XS file. Perl reports the error as being | ||||||||||||||||||||||||||||||||
| 201 | # in this perl code simply because this was the last perl code | ||||||||||||||||||||||||||||||||
| 202 | # it executed. | ||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||
| 204 | 0 | my $flags = $module->dl_load_flags; | |||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | my $libref = dl_load_file($file, $flags) or | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 207 | croak("Can't load '$file' for module $module: ".dl_error()); | ||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||
| 209 | 0 | push(@dl_librefs,$libref); # record loaded object | |||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | $boot_symbol_ref = dl_find_symbol($libref, $bootname) or | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 212 | croak("Can't find '$bootname' symbol in $file\n"); | ||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||
| 214 | 0 | push(@dl_modules, $module); # record loaded module | |||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||
| 216 | 0 | boot: | |||||||||||||||||||||||||||||||
| 217 | my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file); | ||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||
| 219 | # See comment block above | ||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||
| 221 | 0 | push(@dl_shared_objects, $file); # record files loaded | |||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||
| 223 | 0 | &$xs(@args); | |||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||
| 226 | sub dl_findfile { | ||||||||||||||||||||||||||||||||
| 227 | # This function does not automatically consider the architecture | ||||||||||||||||||||||||||||||||
| 228 | # or the perl library auto directories. | ||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | my (@args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
dl_findfile: not called CC=24 SCAR=64.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 230 | 0 | my (@dirs, $dir); # which directories to search | |||||||||||||||||||||||||||||||
| 231 | 0 | my (@found); # full paths to real files we have found | |||||||||||||||||||||||||||||||
| 232 | #my $dl_ext= 'so'; # $Config::Config{'dlext'} suffix for perl extensions | ||||||||||||||||||||||||||||||||
| 233 | #my $dl_so = 'so'; # $Config::Config{'so'} suffix for shared libraries | ||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | print STDERR "dl_findfile(@args)\n" if $dl_debug; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||
| 237 | # accumulate directories but process files as they appear | ||||||||||||||||||||||||||||||||
| 238 | 0 | arg: foreach(@args) { | |||||||||||||||||||||||||||||||
| 239 | # Special fast case: full filepath requires no search | ||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | if (m:/: && -f $_) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
m[/] and -f $_
MC/DC0%0/2
m[/] and -f $_
m[/]
-f $_
Truth table0%0/3
A and B
A= m[/]B= -f $_
| |||||||||||||||||||||||||||||||||
| 243 | 0 | push(@found,$_); | |||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | last arg unless wantarray; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 245 | 0 | next; | |||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||
| 249 | # Deal with directories first: | ||||||||||||||||||||||||||||||||
| 250 | # Using a -L prefix is the preferred option (faster and more robust) | ||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ( s{^-L}{} ) { push(@dirs, $_); next; } | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||
| 253 | # Otherwise we try to try to spot directories by a heuristic | ||||||||||||||||||||||||||||||||
| 254 | # (this is a more complicated issue than it first appears) | ||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | if (m:/: && -d $_) { push(@dirs, $_); next; } | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
m[/] and -d $_
MC/DC0%0/2
m[/] and -d $_
m[/]
-d $_
Truth table0%0/3
A and B
A= m[/]B= -d $_
| |||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||
| 259 | # Only files should get this far... | ||||||||||||||||||||||||||||||||
| 260 | 0 | my(@names, $name); # what filenames to look for | |||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | if ( s{^-l}{} ) { # convert -lname to appropriate library name | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 262 | 0 | push(@names, "lib$_.$dl_so", "lib$_.a"); | |||||||||||||||||||||||||||||||
| 263 | } else { # Umm, a bare name. Try various alternatives: | ||||||||||||||||||||||||||||||||
| 264 | # these should be ordered with the most likely first | ||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | push(@names,"$_.$dl_dlext") unless m/\.$dl_dlext$/o; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | push(@names,"$_.$dl_so") unless m/\.$dl_so$/o; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | push(@names,"lib$_.$dl_so") unless m:/:; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 269 | 0 | push(@names, $_); | |||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||
| 271 | 0 | my $dirsep = '/'; | |||||||||||||||||||||||||||||||
| 272 | 0 | foreach $dir (@dirs, @dl_library_path) { | |||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | next unless -d $dir; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||
| 275 | 0 | foreach $name (@names) { | |||||||||||||||||||||||||||||||
| 276 | 0 | my($file) = "$dir$dirsep$name"; | |||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | print STDERR " checking in $dir for $name\n" if $dl_debug; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | if ($do_expand && ($file = dl_expandspec($file))) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$do_expand and $file = dl_expandspec($file)
MC/DC0%0/2
$do_expand and $file = dl_expandspec($file)
$do_expand
$file = dl_expandspec($file)
Truth table0%0/3
A and B
A= $do_expandB= $file = dl_expandspec($file)
| |||||||||||||||||||||||||||||||||
| 279 | 0 | push @found, $file; | |||||||||||||||||||||||||||||||
| 280 | 0 | next arg; # no need to look any further | |||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||
| 282 | elsif (-f $file) { | ||||||||||||||||||||||||||||||||
| 283 | 0 | push(@found, $file); | |||||||||||||||||||||||||||||||
| 284 | 0 | next arg; # no need to look any further | |||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | if ($dl_debug) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 291 | 0 | foreach(@dirs) { | |||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | print STDERR " dl_findfile ignored non-existent directory: $_\n" unless -d $_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||
| 294 | 0 | print STDERR "dl_findfile found: @found\n"; | |||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | return $found[0] unless wantarray; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 297 | 0 | @found; | |||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||
| 302 | sub dl_expandspec { | ||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | my($spec) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
dl_expandspec: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 304 | # Optional function invoked if DynaLoader.pm sets $do_expand. | ||||||||||||||||||||||||||||||||
| 305 | # Most systems do not require or use this function. | ||||||||||||||||||||||||||||||||
| 306 | # Some systems may implement it in the dl_*.xs file in which case | ||||||||||||||||||||||||||||||||
| 307 | # this Perl version should be excluded at build time. | ||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||
| 309 | # This function is designed to deal with systems which treat some | ||||||||||||||||||||||||||||||||
| 310 | # 'filenames' in a special way. For example VMS 'Logical Names' | ||||||||||||||||||||||||||||||||
| 311 | # (something like unix environment variables - but different). | ||||||||||||||||||||||||||||||||
| 312 | # This function should recognise such names and expand them into | ||||||||||||||||||||||||||||||||
| 313 | # full file paths. | ||||||||||||||||||||||||||||||||
| 314 | # Must return undef if $spec is invalid or file does not exist. | ||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||
| 316 | 0 | my $file = $spec; # default output to input | |||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | return undef unless -f $file; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | print STDERR "dl_expandspec($spec) => $file\n" if $dl_debug; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 320 | 0 | $file; | |||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||
| 323 | sub dl_find_symbol_anywhere | ||||||||||||||||||||||||||||||||
| 324 | { | ||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | my $sym = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
dl_find_symbol_anywhere: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 326 | 0 | my $libref; | |||||||||||||||||||||||||||||||
| 327 | 0 | foreach $libref (@dl_librefs) { | |||||||||||||||||||||||||||||||
| 328 | 0 | my $symref = dl_find_symbol($libref,$sym,1); | |||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | return $symref if $symref; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||
| 331 | 0 | return undef; | |||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||
| 334 | __END__ | ||||||||||||||||||||||||||||||||