# In case the empty lib/ directory was not created.
mkdir 'lib', 0755 unless $ENV{PERL_CORE};
+# starting with Perl 5.11, "site" and "vendor" directories finally are
+# before "perl" (core) in @INC, thus allowing dual-life modules to be
+# updated without the need to overwrite the old version
+my $installdirs = $] < 5.011 ? "perl" : "site";
+
WriteMakefile(
NAME => $PACKAGE,
LICENSE => 'perl',
AUTHOR => 'Sebastien Aperghis-Tramoni <sebastien@aperghis.net>',
VERSION_FROM => 'XSLoader_pm.PL',
ABSTRACT_FROM => 'XSLoader_pm.PL',
- INSTALLDIRS => 'perl',
+ INSTALLDIRS => $installdirs,
PL_FILES => { 'XSLoader_pm.PL' => 'XSLoader.pm' },
PM => { 'XSLoader.pm' => '$(INST_ARCHLIB)/XSLoader.pm' },
PREREQ_PM => {
package XSLoader;
-$VERSION = "0.13";
+$VERSION = "0.15";
#use strict;
my ($module, $modlibname) = caller();
if (@_) {
- $module = $_[0];
+ $module = $_[0];
} else {
- $_[0] = $module;
+ $_[0] = $module;
}
# work with static linking too
print OUT <<'EOT';
my $modpname = join('/',@modparts);
my $c = @modparts;
- $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename
+ $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename
EOT
my $dl_dlext = quotemeta($Config::Config{'dlext'});
}
EOT
-# Can't test with DynaLoader->can('bootstrap_inherit' when building in the
+# Can't test with DynaLoader->can('bootstrap_inherit') when building in the
# core, as XSLoader gets built before DynaLoader.
if ($] >= 5.006) {
=head1 VERSION
-Version 0.13
+Version 0.15
=head1 SYNOPSIS
C<make install>.
+=head1 KNOWN BUGS
+
+The new simpler way to call C<XSLoader::load()> with no arguments at all
+does not work on Perl 5.8.4 and 5.8.5.
+
+
=head1 BUGS
Please report any bugs or feature requests via the perlbug(1) utility.
=head1 COPYRIGHT & LICENSE
-Copyright (C) 1990-2007 by Larry Wall and others.
+Copyright (C) 1990-2011 by Larry Wall and others.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
my $db_file;
BEGIN {
- eval "use Test::More";
- if ($@) {
+ if (not eval "use Test::More; 1") {
print "1..0 # Skip: Test::More not available\n";
die "Test::More not available\n";
}
+ plan(skip_all => "these tests needs Perl 5.5+") if $] < 5.005;
+
use Config;
foreach (qw/SDBM_File GDBM_File ODBM_File NDBM_File DB_File/) {
if ($Config{extensions} =~ /\b$_\b/) {
can_ok( 'XSLoader' => 'bootstrap_inherit' );
# Check error messages
-foreach (['Thwack', 'package Thwack; XSLoader::load(); 1'],
- ['Zlott', 'package Thwack; XSLoader::load("Zlott"); 1'],
- ) {
- my ($should_load, $codestr) = @$_;
- is(eval $codestr, undef, "eval '$codestr' should die");
+my @cases = (
+ [ 'Thwack', 'package Thwack; XSLoader::load(); 1' ],
+ [ 'Zlott' , 'package Thwack; XSLoader::load("Zlott"); 1' ],
+);
+
+for my $case (@cases) {
+ my ($should_load, $codestr) = @$case;
+ my $diag;
+ # determine the expected diagnostic
if ($Config{usedl}) {
- like( $@, qr/^Can't locate loadable object for module $should_load in \@INC/,
- "calling XSLoader::load() under a package with no XS part" );
- }
- else {
- like( $@, qr/^Can't load module $should_load, dynamic loading not available in this perl./,
- "calling XSLoader::load() under a package with no XS part" );
+ if ($case->[0] eq "Thwack" and ($] == 5.008004 or $] == 5.008005)) {
+ # these versions had bugs with chained C<goto &>
+ $diag = "Usage: DynaLoader::bootstrap\\(module\\)";
+ } else {
+ # normal diagnostic for a perl with dynamic loading
+ $diag = "Can't locate loadable object for module $should_load in \@INC";
+ }
+ } else {
+ # a perl with no dynamic loading
+ $diag = "Can't load module $should_load, dynamic loading not available in this perl.";
}
+
+ is(eval $codestr, undef, "eval '$codestr' should die");
+ like($@, qr/^$diag/, "calling XSLoader::load() under a package with no XS part");
}
# Now try to load well known XS modules
local $SIG{__WARN__} = sub { $warnings = $_[0] };
SKIP: {
- skip "$module not available", 4 if $extensions !~ /\b$module\b/;
+ skip "$module not available", 3 if $extensions !~ /\b$module\b/;
eval qq{ package $module; XSLoader::load('$module', "12345678"); };
- like( $@, "/^$module object version \\S+ does not match bootstrap parameter (?:12345678|0)/",
+ like( $@, "/^$module object version \\S+ does not match bootstrap parameter 12345678/",
"calling XSLoader::load() with a XS module and an incorrect version" );
eval qq{ package $module; XSLoader::load('$module'); };