diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-10-06 19:20:04 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-10-06 19:20:04 +0100 |
commit | 6e0eede9b1aceb547aaf28a246d0f7792ed6e360 (patch) | |
tree | a32e31b49e9529a29989273676105a54e1329e75 /dist/XSLoader/XSLoader_pm.PL | |
parent | d50f1408338c986819086d7001a554dcd41e31f5 (diff) | |
download | perl-6e0eede9b1aceb547aaf28a246d0f7792ed6e360.tar.gz |
Avoid defining a full XSLoader::bootstrap_inherit post 5.6, as it's not needed.
Previously the full pre 5.6 XSLoader::bootstrap_inherit emulation code was
always declared, but only used with a *runtime* check of Perl version.
However, it appears to be part of the implicit API of XSLoader that
XSLoader::bootstrap_inherit exists, so keep a stub implementation post 5.6
the commit.
Diffstat (limited to 'dist/XSLoader/XSLoader_pm.PL')
-rw-r--r-- | dist/XSLoader/XSLoader_pm.PL | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/dist/XSLoader/XSLoader_pm.PL b/dist/XSLoader/XSLoader_pm.PL index f2e5bbc922..47492e1da8 100644 --- a/dist/XSLoader/XSLoader_pm.PL +++ b/dist/XSLoader/XSLoader_pm.PL @@ -8,7 +8,7 @@ print OUT <<'EOT'; package XSLoader; -$VERSION = "0.11"; +$VERSION = "0.12"; #use strict; @@ -34,7 +34,7 @@ sub load { my $boots = "$module\::bootstrap"; goto &$boots if defined &$boots; - goto retry unless $module and defined &dl_load_file; + goto \&XSLoader::bootstrap_inherit unless $module and defined &dl_load_file; my @modparts = split(/::/,$module); my $modfname = $modparts[-1]; @@ -82,7 +82,7 @@ print OUT <<'EOT'; warn "$bs: $@\n" if $@; } - goto retry if not -f $file or -s $bs; + goto \&XSLoader::bootstrap_inherit if not -f $file or -s $bs; my $bootname = "boot_$module"; $bootname =~ s/\W/_/g; @@ -133,15 +133,26 @@ print OUT <<'EOT'; # See comment block above push(@DynaLoader::dl_shared_objects, $file); # record files loaded return &$xs(@_); +} +EOT + +# Can't test with DynaLoader->can('bootstrap_inherit' when building in the +# core, as XSLoader gets built before DynaLoader. - retry: - my $bootstrap_inherit = DynaLoader->can('bootstrap_inherit') || - XSLoader->can('bootstrap_inherit'); - goto &$bootstrap_inherit; +if ($] >= 5.006) { + print OUT <<'EOT'; + +sub bootstrap_inherit { + require DynaLoader; + goto \&DynaLoader::bootstrap_inherit; } -# Versions of DynaLoader prior to 5.6.0 don't have this function. +EOT +} else { + print OUT <<'EOT'; + sub bootstrap_inherit { + # Versions of DynaLoader prior to 5.6.0 don't have bootstrap_inherit. package DynaLoader; my $module = $_[0]; @@ -152,6 +163,10 @@ sub bootstrap_inherit { DynaLoader::bootstrap(@_); } +EOT +} + +print OUT <<'EOT'; 1; |