summaryrefslogtreecommitdiff
path: root/ext/DynaLoader
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-10-14 23:00:35 +0000
committerSteve Peters <steve@fisharerojo.org>2006-10-14 23:00:35 +0000
commit150e77ce34d3aa0165d475fba43d6f619fb12856 (patch)
treef8538b161fbb33b3cb92bfe1c562287b5dc4c891 /ext/DynaLoader
parent2eb97020013532fece8d6206100165c4e92a4350 (diff)
downloadperl-150e77ce34d3aa0165d475fba43d6f619fb12856.tar.gz
Upgrade to XSLoader-0.07.
p4raw-id: //depot/perl@29017
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r--ext/DynaLoader/XSLoader_pm.PL18
-rw-r--r--ext/DynaLoader/t/XSLoader.t52
2 files changed, 43 insertions, 27 deletions
diff --git a/ext/DynaLoader/XSLoader_pm.PL b/ext/DynaLoader/XSLoader_pm.PL
index 59ffbc67e1..d95cdb05cd 100644
--- a/ext/DynaLoader/XSLoader_pm.PL
+++ b/ext/DynaLoader/XSLoader_pm.PL
@@ -15,7 +15,7 @@ print OUT <<'EOT';
package XSLoader;
-$VERSION = "0.06";
+$VERSION = "0.07";
#use strict;
@@ -150,7 +150,7 @@ XSLoader - Dynamically load C libraries into Perl code
=head1 VERSION
-Version 0.06
+Version 0.07
=head1 SYNOPSIS
@@ -318,24 +318,24 @@ this:
=head1 DIAGNOSTICS
-=over 4
+=over
-=item Can't find '%s' symbol in %s
+=item C<Can't find '%s' symbol in %s>
B<(F)> The bootstrap symbol could not be found in the extension module.
-=item Can't load '%s' for module %s: %s
+=item C<Can't load '%s' for module %s: %s>
B<(F)> The loading or initialisation of the extension module failed.
The detailed error follows.
-=item Undefined symbols present after loading %s: %s
+=item C<Undefined symbols present after loading %s: %s>
B<(W)> As the message says, some symbols stay undefined although the
extension module was correctly loaded and initialised. The list of undefined
symbols follows.
-=item XSLoader::load('Your::Module', $Your::Module::VERSION)
+=item C<XSLoader::load('Your::Module', $Your::Module::VERSION)>
B<(F)> You tried to invoke C<load()> without any argument. You must supply
a module name, and optionally its version.
@@ -371,9 +371,9 @@ L<DynaLoader>
Ilya Zakharevich originally extracted C<XSLoader> from C<DynaLoader>.
CPAN version is currently maintained by SE<eacute>bastien Aperghis-Tramoni
-E<lt>sebastien@aperghis.netE<gt>
+E<lt>sebastien@aperghis.netE<gt>.
-Previous maintainer was Michael G Schwern <schwern@pobox.com>
+Previous maintainer was Michael G Schwern <schwern@pobox.com>.
=head1 COPYRIGHT
diff --git a/ext/DynaLoader/t/XSLoader.t b/ext/DynaLoader/t/XSLoader.t
index 4af9a3472a..82dca56dff 100644
--- a/ext/DynaLoader/t/XSLoader.t
+++ b/ext/DynaLoader/t/XSLoader.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -wT
+#!/usr/bin/perl -T
BEGIN {
if( $ENV{PERL_CORE} ) {
@@ -9,43 +9,59 @@ BEGIN {
use strict;
use Config;
-use Test::More;
-my %modules;
+
BEGIN {
- %modules = (
- # ModuleName => q|code to check that it was loaded|,
- 'Cwd' => q| ::is( ref Cwd->can('fastcwd'),'CODE' ) |, # 5.7 ?
- 'File::Glob' => q| ::is( ref File::Glob->can('doglob'),'CODE' ) |, # 5.6
- 'SDBM_File' => q| ::is( ref SDBM_File->can('TIEHASH'), 'CODE' ) |, # 5.0
- 'Socket' => q| ::is( ref Socket->can('inet_aton'),'CODE' ) |, # 5.0
- 'Time::HiRes'=> q| ::is( ref Time::HiRes->can('usleep'),'CODE' ) |, # 5.7.3
- );
- plan tests => keys(%modules) * 2 + 3
+ eval "use Test::More";
+ if ($@) {
+ print "1..0 # Skip: Test::More not available\n";
+ die "Test::More not available\n";
+ }
}
-BEGIN {
- use_ok( 'XSLoader' );
-}
+my %modules = (
+ # ModuleName => q|code to check that it was loaded|,
+ 'Cwd' => q| ::can_ok( 'Cwd' => 'fastcwd' ) |, # 5.7 ?
+ 'File::Glob' => q| ::can_ok( 'File::Glob' => 'doglob' ) |, # 5.6
+ 'SDBM_File' => q| ::can_ok( 'SDBM_File' => 'TIEHASH' ) |, # 5.0
+ 'Socket' => q| ::can_ok( 'Socket' => 'inet_aton' ) |, # 5.0
+ 'Time::HiRes'=> q| ::can_ok( 'Time::HiRes' => 'usleep' ) |, # 5.7.3
+);
+
+plan tests => keys(%modules) * 3 + 5;
+
+# Try to load the module
+use_ok( 'XSLoader' );
# Check functions
can_ok( 'XSLoader' => 'load' );
-#can_ok( 'XSLoader' => 'bootstrap_inherit' ); # doesn't work
+can_ok( 'XSLoader' => 'bootstrap_inherit' );
# Check error messages
eval { XSLoader::load() };
like( $@, '/^XSLoader::load\(\'Your::Module\', \$Your::Module::VERSION\)/',
"calling XSLoader::load() with no argument" );
+eval q{ package Thwack; XSLoader::load('Thwack'); };
+like( $@, q{/^Can't locate loadable object for module Thwack in @INC/},
+ "calling XSLoader::load() under a package with no XS part" );
+
# Now try to load well known XS modules
my $extensions = $Config{'extensions'};
$extensions =~ s|/|::|g;
for my $module (sort keys %modules) {
SKIP: {
- skip "$module not available", 2 if $extensions !~ /\b$module\b/;
- eval qq| package $module; XSLoader::load('$module'); | . $modules{$module};
+ skip "$module not available", 3 if $extensions !~ /\b$module\b/;
+
+ eval qq{ package $module; XSLoader::load('$module', "qunckkk"); };
+ like( $@, "/^$module object version \\S+ does not match bootstrap parameter (?:qunckkk|0\\.000)/",
+ "calling XSLoader::load() with a XS module and an incorrect version" );
+
+ eval qq{ package $module; XSLoader::load('$module'); };
is( $@, '', "XSLoader::load($module)");
+
+ eval qq{ package $module; $modules{$module}; };
}
}