Here are some patches for QNX6 against 5.10.x. Unpatched and patched
[p5sagit/p5-mst-13.2.git] / lib / Module / Load.pm
index f302c0a..08f64b2 100644 (file)
@@ -1,6 +1,6 @@
 package Module::Load;
 
-$VERSION = '0.12';
+$VERSION = '0.16';
 
 use strict;
 use File::Spec ();
@@ -30,18 +30,17 @@ sub load (*;@)  {
             die $err if $err;
         }
     }
-    __PACKAGE__->_export_to_level(1, $mod, @_) if @_;
-}
-
-### 5.004's Exporter doesn't have export_to_level.
-### Taken from Michael Schwerns Test::More and slightly modified
-sub _export_to_level {
-    my $pkg     = shift;
-    my $level   = shift;
-    my $mod     = shift;
-    my $callpkg = caller($level);
-
-    $mod->export($callpkg, @_);
+    
+    ### This addresses #41883: Module::Load cannot import 
+    ### non-Exporter module. ->import() routines weren't
+    ### properly called when load() was used.
+    {   no strict 'refs';
+        my $import;
+        if (@_ and $import = $mod->can('import')) {
+            unshift @_, $mod;
+            goto &$import;
+        }
+    }
 }
 
 sub _to_file{