Subject: | use XSLoader if possible for more lightweight load |
XSLoader is the new shiny since perl 5.6. It's more light weight to load XS over DynaLoader,
which this module currently uses.
I suggest attempting to use XSLoader and fail back to DynaLoader if it's not available.
Subject: | patch.txt |
diff --git a/Mmap.pm b/Mmap.pm
index f0f370c..324d921 100644
--- a/Mmap.pm
+++ b/Mmap.pm
@@ -180,10 +180,9 @@ compliant and contributed documentation as well.
=cut
use strict;
-use vars qw($VERSION @ISA @EXPORT $AUTOLOAD);
-require DynaLoader;
+our ($VERSION, @ISA, @EXPORT, $AUTOLOAD);
require Exporter;
-@ISA = qw(Exporter DynaLoader);
+@ISA = qw(Exporter);
@EXPORT = qw(mmap munmap
MAP_ANON MAP_ANONYMOUS MAP_FILE MAP_PRIVATE MAP_SHARED
@@ -289,8 +288,16 @@ sub AUTOLOAD {
goto &$AUTOLOAD;
}
-bootstrap Sys::Mmap $VERSION;
+eval {
+ require XSLoader;
+ XSLoader::load( 'Sys::Mmap', $VERSION );
+} or do {
+ require DynaLoader;
+ push @ISA, 'DynaLoader';
+ bootstrap Sys::Mmap $VERSION;
+};
1;
__END__
+