Upgrade Attribute::Handlers to 0.84
[p5sagit/p5-mst-13.2.git] / ext / DynaLoader / XSLoader_pm.PL
index 2f8b3e8..a258f6e 100644 (file)
@@ -15,7 +15,7 @@ print OUT <<'EOT';
 
 package XSLoader;
 
-$VERSION = "0.07";
+$VERSION = "0.10";
 
 #use strict;
 
@@ -44,8 +44,8 @@ sub load {
     my($module) = $_[0];
 
     # work with static linking too
-    my $b = "$module\::bootstrap";
-    goto &$b if defined &$b;
+    my $boots = "$module\::bootstrap";
+    goto &$boots if defined &$boots;
 
     goto retry unless $module and defined &dl_load_file;
 
@@ -62,6 +62,13 @@ print OUT <<'EOT' if defined &DynaLoader::mod2fname;
 
 EOT
 
+print OUT <<'EOT' if $^O eq 'os2';
+
+    # os2 static build can dynaload, but cannot dynaload Perl modules...
+    die 'Dynaloaded Perl modules are not available in this build of Perl' if $OS2::is_static;
+
+EOT
+
 print OUT <<'EOT';
     my $modpname = join('/',@modparts);
     my $modlibname = (caller())[1];
@@ -74,6 +81,12 @@ print OUT <<'EOT';
     my $bs = $file;
     $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
 
+    if (-s $bs) { # only read file if it's not empty
+#       print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
+        eval { do $bs; };
+        warn "$bs: $@\n" if $@;
+    }
+
     goto retry if not -f $file or -s $bs;
 
     my $bootname = "boot_$module";
@@ -120,7 +133,7 @@ print OUT <<'EOT';
     push(@DynaLoader::dl_modules, $module); # record loaded module
 
   boot:
-    my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
+    my $xs = dl_install_xsub($boots, $boot_symbol_ref, $file);
 
     # See comment block above
     push(@DynaLoader::dl_shared_objects, $file); # record files loaded
@@ -155,7 +168,7 @@ XSLoader - Dynamically load C libraries into Perl code
 
 =head1 VERSION
 
-Version 0.07
+Version 0.10
 
 =head1 SYNOPSIS
 
@@ -381,7 +394,9 @@ E<lt>sebastien@aperghis.netE<gt>.
 Previous maintainer was Michael G Schwern <schwern@pobox.com>.
 
 
-=head1 COPYRIGHT
+=head1 COPYRIGHT & LICENSE
+
+Copyright (C) 1990-2007 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.