Change 20944 by [EMAIL PROTECTED] on 2003/08/30 05:50:41

        Subject: [PATCH] XSLoader nits and tests
        From: Michael G Schwern <[EMAIL PROTECTED]>
        Date: Fri, 29 Aug 2003 22:55:07 -0700
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/MANIFEST#1079 edit
... //depot/perl/ext/DynaLoader/XSLoader_pm.PL#6 edit
... //depot/perl/ext/DynaLoader/t/XSLoader.t#1 add

Differences ...

==== //depot/perl/MANIFEST#1079 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1078~20940~   Fri Aug 29 14:17:59 2003
+++ perl/MANIFEST       Fri Aug 29 22:50:41 2003
@@ -214,6 +214,7 @@
 ext/DynaLoader/hints/openbsd.pl        Hint for DynaLoader for named architecture
 ext/DynaLoader/Makefile.PL     Dynamic Loader makefile writer
 ext/DynaLoader/README          Dynamic Loader notes and intro
+ext/DynaLoader/t/XSLoader.t     See if XSLoader works
 ext/DynaLoader/XSLoader_pm.PL  Simple XS Loader perl module
 ext/Encode/AUTHORS             List of authors
 ext/Encode/bin/enc2xs          Encode module generator

==== //depot/perl/ext/DynaLoader/XSLoader_pm.PL#6 (text) ====
Index: perl/ext/DynaLoader/XSLoader_pm.PL
--- perl/ext/DynaLoader/XSLoader_pm.PL#5~20634~ Tue Aug 12 01:41:49 2003
+++ perl/ext/DynaLoader/XSLoader_pm.PL  Fri Aug 29 22:50:41 2003
@@ -14,19 +14,7 @@
 
 package XSLoader;
 
-#   And Gandalf said: 'Many folk like to know beforehand what is to
-#   be set on the table; but those who have laboured to prepare the
-#   feast like to keep their secret; for wonder makes the words of
-#   praise louder.'
-
-#   (Quote from Tolkien sugested by Anno Siegel.)
-#
-# See pod text at end of file for documentation.
-# See also ext/DynaLoader/README in source tree for other information.
-#
-# [EMAIL PROTECTED], August 1994
-
-$VERSION = "0.01";     # avoid typo warning
+$VERSION = "0.02";
 
 # enable debug/trace messages from DynaLoader perl code
 # $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug;
@@ -45,14 +33,11 @@
                                 !defined(&dl_error);
 package XSLoader;
 
-1; # End of main code
-
-# The bootstrap function cannot be autoloaded (without complications)
-# so we define it here:
-
 sub load {
     package DynaLoader;
 
+    die q{XSLoader::load('Your::Module', $Your::Module::VERSION)} unless @_;
+
     my($module) = $_[0];
 
     # work with static linking too
@@ -137,6 +122,8 @@
     goto &DynaLoader::bootstrap_inherit;
 }
 
+1;
+
 __END__
 
 =head1 NAME
@@ -148,7 +135,7 @@
     package YourPackage;
     use XSLoader;
 
-    XSLoader::load 'YourPackage', @args;
+    XSLoader::load 'YourPackage', $YourPackage::VERSION;
 
 =head1 DESCRIPTION
 

==== //depot/perl/ext/DynaLoader/t/XSLoader.t#1 (text) ====
Index: perl/ext/DynaLoader/t/XSLoader.t
--- /dev/null   Tue May  5 13:32:27 1998
+++ perl/ext/DynaLoader/t/XSLoader.t    Fri Aug 29 22:50:41 2003
@@ -0,0 +1,20 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+    chdir 't';
+#    @INC = '../lib';
+}
+
+use Test;
+plan tests => 4;
+
+use XSLoader;
+ok(1);
+ok( ref XSLoader->can('load') );
+
+eval { XSLoader::load(); };
+ok( $@ =~ /^XSLoader::load\('Your::Module', \$Your::Module::VERSION\)/ );
+
+package SDBM_File;
+XSLoader::load('SDBM_File');
+::ok( ref SDBM_File->can('TIEHASH') );
End of Patch.

Reply via email to