| File | /usr/lib/perl/5.8/DynaLoader.pm | Statements Executed | 74 | Total Time | 0.073827 seconds |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine | |
|---|---|---|---|---|---|---|
| 2 | 1 | 2 | 0.06078 | 0.06078 | DynaLoader:: | dl_load_file (xsub) |
| 1 | 1 | 1 | 0.00020 | 0.06120 | DynaLoader:: | bootstrap |
| 2 | 1 | 2 | 2.1e-5 | 2.1e-5 | DynaLoader:: | dl_undef_symbols (xsub) |
| 2 | 1 | 2 | 2.0e-5 | 2.0e-5 | DynaLoader:: | dl_install_xsub (xsub) |
| 2 | 1 | 2 | 1.8e-5 | 1.8e-5 | DynaLoader:: | dl_find_symbol (xsub) |
| 1 | 1 | 1 | 1.3e-5 | 1.3e-5 | DynaLoader:: | dl_load_flags |
| 0 | 0 | 0 | 0 | 0 | DynaLoader:: | BEGIN |
| 0 | 0 | 0 | 0 | 0 | DynaLoader:: | bootstrap_inherit |
| 0 | 0 | 0 | 0 | 0 | DynaLoader:: | croak |
| Line | Stmts. | Exclusive Time | Avg. | Code |
|---|---|---|---|---|
| 1 | # Generated from DynaLoader.pm.PL | |||
| 2 | ||||
| 3 | package DynaLoader; | |||
| 4 | ||||
| 5 | # And Gandalf said: 'Many folk like to know beforehand what is to | |||
| 6 | # be set on the table; but those who have laboured to prepare the | |||
| 7 | # feast like to keep their secret; for wonder makes the words of | |||
| 8 | # praise louder.' | |||
| 9 | ||||
| 10 | # (Quote from Tolkien suggested by Anno Siegel.) | |||
| 11 | # | |||
| 12 | # See pod text at end of file for documentation. | |||
| 13 | # See also ext/DynaLoader/README in source tree for other information. | |||
| 14 | # | |||
| 15 | # Tim.Bunce@ig.co.uk, August 1994 | |||
| 16 | ||||
| 17 | 3 | 9.8e-5 | 3.3e-5 | use vars qw($VERSION *AUTOLOAD); # spent 77µs making 1 call to vars::import |
| 18 | ||||
| 19 | 1 | 2.0e-6 | 2.0e-6 | $VERSION = '1.04'; # avoid typo warning |
| 20 | ||||
| 21 | 1 | 0.01051 | 0.01051 | require AutoLoader; |
| 22 | 1 | 4.0e-6 | 4.0e-6 | *AUTOLOAD = \&AutoLoader::AUTOLOAD; |
| 23 | ||||
| 24 | 3 | 0.00188 | 0.00063 | use Config; # spent 37µs making 1 call to Config::import |
| 25 | ||||
| 26 | # The following require can't be removed during maintenance | |||
| 27 | # releases, sadly, because of the risk of buggy code that does | |||
| 28 | # require Carp; Carp::croak "..."; without brackets dying | |||
| 29 | # if Carp hasn't been loaded in earlier compile time. :-( | |||
| 30 | # We'll let those bugs get found on the development track. | |||
| 31 | 1 | 2.0e-6 | 2.0e-6 | require Carp if $] < 5.00450; |
| 32 | ||||
| 33 | # enable debug/trace messages from DynaLoader perl code | |||
| 34 | 1 | 3.0e-6 | 3.0e-6 | $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug; |
| 35 | ||||
| 36 | # | |||
| 37 | # Flags to alter dl_load_file behaviour. Assigned bits: | |||
| 38 | # 0x01 make symbols available for linking later dl_load_file's. | |||
| 39 | # (only known to work on Solaris 2 using dlopen(RTLD_GLOBAL)) | |||
| 40 | # (ignored under VMS; effect is built-in to image linking) | |||
| 41 | # | |||
| 42 | # This is called as a class method $module->dl_load_flags. The | |||
| 43 | # definition here will be inherited and result on "default" loading | |||
| 44 | # behaviour unless a sub-class of DynaLoader defines its own version. | |||
| 45 | # | |||
| 46 | ||||
| 47 | 1 | 3.0e-6 | 3.0e-6 | # spent 13µs within DynaLoader::dl_load_flags which was called
# once (13µs+0) by DynaLoader::bootstrap at line 225 |
| 48 | ||||
| 49 | # ($dl_dlext, $dlsrc) | |||
| 50 | # = @Config::Config{'dlext', 'dlsrc'}; | |||
| 51 | 1 | 3.0e-6 | 3.0e-6 | ($dl_dlext, $dlsrc) = ('so','dl_dlopen.xs') |
| 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 | 1 | 3.0e-6 | 3.0e-6 | $Is_VMS = $^O eq 'VMS'; |
| 58 | 1 | 1.0e-6 | 1.0e-6 | $do_expand = $Is_VMS; |
| 59 | 1 | 2.0e-6 | 2.0e-6 | $Is_MacOS = $^O eq 'MacOS'; |
| 60 | ||||
| 61 | 1 | 1.0e-6 | 1.0e-6 | my $Mac_FS; |
| 62 | 1 | 1.0e-6 | 1.0e-6 | $Mac_FS = eval { require Mac::FileSpec::Unixish } if $Is_MacOS; |
| 63 | ||||
| 64 | 1 | 2.0e-6 | 2.0e-6 | @dl_require_symbols = (); # names of symbols we need |
| 65 | 1 | 1.0e-6 | 1.0e-6 | @dl_resolve_using = (); # names of files to link with |
| 66 | 1 | 2.0e-6 | 2.0e-6 | @dl_library_path = (); # path to look for files |
| 67 | ||||
| 68 | #XSLoader.pm may have added elements before we were required | |||
| 69 | #@dl_librefs = (); # things we have loaded | |||
| 70 | #@dl_modules = (); # Modules we have loaded | |||
| 71 | ||||
| 72 | # This is a fix to support DLD's unfortunate desire to relink -lc | |||
| 73 | 1 | 1.0e-6 | 1.0e-6 | @dl_resolve_using = dl_findfile('-lc') if $dlsrc eq "dl_dld.xs"; |
| 74 | ||||
| 75 | # Initialise @dl_library_path with the 'standard' library path | |||
| 76 | # for this platform as determined by Configure. | |||
| 77 | ||||
| 78 | 1 | 2.7e-5 | 2.7e-5 | push(@dl_library_path, split(' ', $Config::Config{libpth})); # spent 18µs making 1 call to Config::FETCH |
| 79 | ||||
| 80 | 1 | 1.5e-5 | 1.5e-5 | my $ldlibpthname = $Config::Config{ldlibpthname}; # spent 13µs making 1 call to Config::FETCH |
| 81 | 1 | 1.3e-5 | 1.3e-5 | my $ldlibpthname_defined = defined $Config::Config{ldlibpthname}; # spent 11µs making 1 call to Config::FETCH |
| 82 | 1 | 1.4e-5 | 1.4e-5 | my $pthsep = $Config::Config{path_sep}; # spent 12µs making 1 call to Config::FETCH |
| 83 | ||||
| 84 | # Add to @dl_library_path any extra directories we can gather from environment | |||
| 85 | # during runtime. | |||
| 86 | ||||
| 87 | 1 | 2.0e-6 | 2.0e-6 | if ($ldlibpthname_defined && |
| 88 | exists $ENV{$ldlibpthname}) { | |||
| 89 | push(@dl_library_path, split(/$pthsep/, $ENV{$ldlibpthname})); | |||
| 90 | } | |||
| 91 | ||||
| 92 | # E.g. HP-UX supports both its native SHLIB_PATH *and* LD_LIBRARY_PATH. | |||
| 93 | ||||
| 94 | 1 | 1.0e-6 | 1.0e-6 | if ($ldlibpthname_defined && |
| 95 | $ldlibpthname ne 'LD_LIBRARY_PATH' && | |||
| 96 | exists $ENV{LD_LIBRARY_PATH}) { | |||
| 97 | push(@dl_library_path, split(/$pthsep/, $ENV{LD_LIBRARY_PATH})); | |||
| 98 | } | |||
| 99 | ||||
| 100 | # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here. | |||
| 101 | # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB | |||
| 102 | 1 | 2.0e-6 | 2.0e-6 | boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && |
| 103 | !defined(&dl_error); | |||
| 104 | ||||
| 105 | 1 | 1.0e-6 | 1.0e-6 | if ($dl_debug) { |
| 106 | print STDERR "DynaLoader.pm loaded (@INC, @dl_library_path)\n"; | |||
| 107 | print STDERR "DynaLoader not linked into this perl\n" | |||
| 108 | unless defined(&boot_DynaLoader); | |||
| 109 | } | |||
| 110 | ||||
| 111 | 1 | 4.1e-5 | 4.1e-5 | 1; # End of main code |
| 112 | ||||
| 113 | sub croak { require Carp; Carp::croak(@_) } | |||
| 114 | ||||
| 115 | sub bootstrap_inherit { | |||
| 116 | my $module = $_[0]; | |||
| 117 | local *isa = *{"$module\::ISA"}; | |||
| 118 | local @isa = (@isa, 'DynaLoader'); | |||
| 119 | # Cannot goto due to delocalization. Will report errors on a wrong line? | |||
| 120 | bootstrap(@_); | |||
| 121 | } | |||
| 122 | ||||
| 123 | # The bootstrap function cannot be autoloaded (without complications) | |||
| 124 | # so we define it here: | |||
| 125 | ||||
| 126 | # spent 61.2ms (203µs+61.0) within DynaLoader::bootstrap which was called
# once (203µs+61.0ms) at line 19 of /usr/local/lib/perl/5.8.8/Geo/IP.pm | |||
| 127 | # use local vars to enable $module.bs script to edit values | |||
| 128 | 31 | 0.06113 | 0.00197 | local(@args) = @_; |
| 129 | local($module) = $args[0]; | |||
| 130 | local(@dirs, $file); | |||
| 131 | ||||
| 132 | unless ($module) { | |||
| 133 | require Carp; | |||
| 134 | Carp::confess("Usage: DynaLoader::bootstrap(module)"); | |||
| 135 | } | |||
| 136 | ||||
| 137 | # A common error on platforms which don't support dynamic loading. | |||
| 138 | # Since it's fatal and potentially confusing we give a detailed message. | |||
| 139 | croak("Can't load module $module, dynamic loading not available in this perl.\n". | |||
| 140 | " (You may need to build a new perl executable which either supports\n". | |||
| 141 | " dynamic loading or has the $module module statically linked into it.)\n") | |||
| 142 | unless defined(&dl_load_file); | |||
| 143 | ||||
| 144 | my @modparts = split(/::/,$module); | |||
| 145 | my $modfname = $modparts[-1]; | |||
| 146 | ||||
| 147 | # Some systems have restrictions on files names for DLL's etc. | |||
| 148 | # mod2fname returns appropriate file base name (typically truncated) | |||
| 149 | # It may also edit @modparts if required. | |||
| 150 | $modfname = &mod2fname(\@modparts) if defined &mod2fname; | |||
| 151 | ||||
| 152 | # Truncate the module name to 8.3 format for NetWare | |||
| 153 | if (($^O eq 'NetWare') && (length($modfname) > 8)) { | |||
| 154 | $modfname = substr($modfname, 0, 8); | |||
| 155 | } | |||
| 156 | ||||
| 157 | my $modpname = join(($Is_MacOS ? ':' : '/'),@modparts); | |||
| 158 | ||||
| 159 | print STDERR "DynaLoader::bootstrap for $module ", | |||
| 160 | ($Is_MacOS | |||
| 161 | ? "(:auto:$modpname:$modfname.$dl_dlext)\n" : | |||
| 162 | "(auto/$modpname/$modfname.$dl_dlext)\n") | |||
| 163 | if $dl_debug; | |||
| 164 | ||||
| 165 | foreach (@INC) { | |||
| 166 | 10 | 5.0e-5 | 5.0e-6 | chop($_ = VMS::Filespec::unixpath($_)) if $Is_VMS; |
| 167 | my $dir; | |||
| 168 | 2 | 7.0e-6 | 3.5e-6 | if ($Is_MacOS) { |
| 169 | my $path = $_; | |||
| 170 | if ($Mac_FS && ! -d $path) { | |||
| 171 | $path = Mac::FileSpec::Unixish::nativize($path); | |||
| 172 | } | |||
| 173 | $path .= ":" unless /:$/; | |||
| 174 | $dir = "${path}auto:$modpname"; | |||
| 175 | } else { | |||
| 176 | $dir = "$_/auto/$modpname"; | |||
| 177 | } | |||
| 178 | ||||
| 179 | next unless -d $dir; # skip over uninteresting directories | |||
| 180 | ||||
| 181 | # check for common cases to avoid autoload of dl_findfile | |||
| 182 | my $try = $Is_MacOS ? "$dir:$modfname.$dl_dlext" : "$dir/$modfname.$dl_dlext"; | |||
| 183 | last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try); | |||
| 184 | ||||
| 185 | # no luck here, save dir for possible later dl_findfile search | |||
| 186 | push @dirs, $dir; | |||
| 187 | } | |||
| 188 | # last resort, let dl_findfile have a go in all known locations | |||
| 189 | $file = dl_findfile(map("-L$_",@dirs,@INC), $modfname) unless $file; | |||
| 190 | ||||
| 191 | croak("Can't locate loadable object for module $module in \@INC (\@INC contains: @INC)") | |||
| 192 | unless $file; # wording similar to error from 'require' | |||
| 193 | ||||
| 194 | $file = uc($file) if $Is_VMS && $Config::Config{d_vms_case_sensitive_symbols}; | |||
| 195 | my $bootname = "boot_$module"; | |||
| 196 | $bootname =~ s/\W/_/g; | |||
| 197 | @dl_require_symbols = ($bootname); | |||
| 198 | ||||
| 199 | # Execute optional '.bootstrap' perl script for this module. | |||
| 200 | # The .bs file can be used to configure @dl_resolve_using etc to | |||
| 201 | # match the needs of the individual module on this architecture. | |||
| 202 | my $bs = $file; | |||
| 203 | $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library | |||
| 204 | if (-s $bs) { # only read file if it's not empty | |||
| 205 | print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug; | |||
| 206 | eval { do $bs; }; | |||
| 207 | warn "$bs: $@\n" if $@; | |||
| 208 | } | |||
| 209 | ||||
| 210 | my $boot_symbol_ref; | |||
| 211 | ||||
| 212 | if ($^O eq 'darwin') { | |||
| 213 | if ($boot_symbol_ref = dl_find_symbol(0, $bootname)) { | |||
| 214 | goto boot; #extension library has already been loaded, e.g. darwin | |||
| 215 | } | |||
| 216 | } | |||
| 217 | ||||
| 218 | # Many dynamic extension loading problems will appear to come from | |||
| 219 | # this section of code: XYZ failed at line 123 of DynaLoader.pm. | |||
| 220 | # Often these errors are actually occurring in the initialisation | |||
| 221 | # C code of the extension XS file. Perl reports the error as being | |||
| 222 | # in this perl code simply because this was the last perl code | |||
| 223 | # it executed. | |||
| 224 | ||||
| 225 | my $libref = dl_load_file($file, $module->dl_load_flags) or # spent 60.8ms making 1 call to DynaLoader::dl_load_file
# spent 13µs making 1 call to DynaLoader::dl_load_flags | |||
| 226 | croak("Can't load '$file' for module $module: ".dl_error()); | |||
| 227 | ||||
| 228 | push(@dl_librefs,$libref); # record loaded object | |||
| 229 | ||||
| 230 | my @unresolved = dl_undef_symbols(); # spent 21µs making 1 call to DynaLoader::dl_undef_symbols | |||
| 231 | if (@unresolved) { | |||
| 232 | require Carp; | |||
| 233 | Carp::carp("Undefined symbols present after loading $file: @unresolved\n"); | |||
| 234 | } | |||
| 235 | ||||
| 236 | $boot_symbol_ref = dl_find_symbol($libref, $bootname) or # spent 18µs making 1 call to DynaLoader::dl_find_symbol | |||
| 237 | croak("Can't find '$bootname' symbol in $file\n"); | |||
| 238 | ||||
| 239 | push(@dl_modules, $module); # record loaded module | |||
| 240 | ||||
| 241 | boot: # spent 20µs making 1 call to DynaLoader::dl_install_xsub | |||
| 242 | my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file); | |||
| 243 | ||||
| 244 | # See comment block above | |||
| 245 | &$xs(@args); # spent 144µs making 1 call to Geo::IP::bootstrap | |||
| 246 | } | |||
| 247 | ||||
| 248 | #sub _check_file { # private utility to handle dl_expandspec vs -f tests | |||
| 249 | # my($file) = @_; | |||
| 250 | # return $file if (!$do_expand && -f $file); # the common case | |||
| 251 | # return $file if ( $do_expand && ($file=dl_expandspec($file))); | |||
| 252 | # return undef; | |||
| 253 | #} | |||
| 254 | ||||
| 255 | # Let autosplit and the autoloader deal with these functions: | |||
# spent 18µs within DynaLoader::dl_find_symbol which was called
# once (18µs+0) by DynaLoader::bootstrap at line 236 of /usr/lib/perl/5.8/DynaLoader.pm | ||||
# spent 20µs within DynaLoader::dl_install_xsub which was called
# once (20µs+0) by DynaLoader::bootstrap at line 241 of /usr/lib/perl/5.8/DynaLoader.pm | ||||
# spent 60.8ms within DynaLoader::dl_load_file which was called
# once (60.8ms+0) by DynaLoader::bootstrap at line 225 of /usr/lib/perl/5.8/DynaLoader.pm | ||||
# spent 21µs within DynaLoader::dl_undef_symbols which was called
# once (21µs+0) by DynaLoader::bootstrap at line 230 of /usr/lib/perl/5.8/DynaLoader.pm |