X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=ext%2FDynaLoader%2FDynaLoader_pm.PL;h=f442579d29cc63965399687cf1c69cfacc54177e;hb=6b9b4622403ed9ea90ace1c72b8b71571b3324a6;hp=9fdaf70be8613f32eed002ce5c9a54f2c5ad7247;hpb=e69a2255d0db4d110e403864fcb97407ce8e4ff9;p=p5sagit%2Fp5-mst-13.2.git diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL index 9fdaf70..f442579 100644 --- a/ext/DynaLoader/DynaLoader_pm.PL +++ b/ext/DynaLoader/DynaLoader_pm.PL @@ -77,6 +77,9 @@ $Is_VMS = $^O eq 'VMS'; $do_expand = $Is_VMS; $Is_MacOS = $^O eq 'MacOS'; +my $Mac_FS; +$Mac_FS = eval { require Mac::FileSpec::Unixish } if $Is_MacOS; + @dl_require_symbols = (); # names of symbols we need @dl_resolve_using = (); # names of files to link with @dl_library_path = (); # path to look for files @@ -234,6 +237,10 @@ sub bootstrap { # It may also edit @modparts if required. $modfname = &mod2fname(\@modparts) if defined &mod2fname; + if (($^O eq 'NetWare') && (length($modfname) > 8)) { + $modfname = substr($modfname, 0, 8); + } + my $modpname = join(($Is_MacOS ? ':' : '/'),@modparts); print STDERR "DynaLoader::bootstrap for $module ", @@ -247,16 +254,29 @@ sub bootstrap { my $dir; if ($Is_MacOS) { my $path = $_; + if ($Mac_FS && ! -d $path) { + $path = Mac::FileSpec::Unixish::nativize($path); + } $path .= ":" unless /:$/; $dir = "${path}auto:$modpname"; } else { $dir = "$_/auto/$modpname"; } - next unless -d $dir; # skip over uninteresting directories + if ($^O ne 'NetWare') { + next unless -d $dir; # skip over uninteresting directories + } + else { + next if -f $dir; # skip over uninteresting directories + } # check for common cases to avoid autoload of dl_findfile my $try = $Is_MacOS ? "$dir:$modfname.$dl_dlext" : "$dir/$modfname.$dl_dlext"; - last if $file = ($do_expand) ? dl_expandspec($try) : (-f $try && $try); + if ($^O ne 'NetWare') { + last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && $try); + } + elsif (!(-d $try)) { + last if $file = ($do_expand) ? dl_expandspec($try) : ($try); + } # no luck here, save dir for possible later dl_findfile search push @dirs, $dir; @@ -283,6 +303,14 @@ sub bootstrap { warn "$bs: $@\n" if $@; } + my $boot_symbol_ref; + + if ($^O eq 'darwin') { + if ($boot_symbol_ref = dl_find_symbol(0, $bootname)) { + goto boot; #extension library has already been loaded, e.g. darwin + } + } + # Many dynamic extension loading problems will appear to come from # this section of code: XYZ failed at line 123 of DynaLoader.pm. # Often these errors are actually occurring in the initialisation @@ -301,13 +329,14 @@ sub bootstrap { Carp::carp("Undefined symbols present after loading $file: @unresolved\n"); } - my $boot_symbol_ref = dl_find_symbol($libref, $bootname) or + $boot_symbol_ref = dl_find_symbol($libref, $bootname) or croak("Can't find '$bootname' symbol in $file\n"); - my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file); - push(@dl_modules, $module); # record loaded module + boot: + my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file); + # See comment block above &$xs(@args); }