In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/5e4a7f813da751856f841bf7729a625911972885?hp=09d15bae7b456c0c9a2719462f699d5fdcf45aa0>

- Log -----------------------------------------------------------------
commit 5e4a7f813da751856f841bf7729a625911972885
Author: Brian Fraser <[email protected]>
Date:   Wed Nov 27 13:25:25 2013 -0300

    Teach ExtUtils::CBuilder to handle mod2fname properly

M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm
M       dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm
M       dist/ExtUtils-CBuilder/t/01-basic.t
M       dist/ExtUtils-CBuilder/t/03-cplusplus.t

commit 90adfb51254f7c48b27dfdf517bb4c245febc453
Author: Brian Fraser <[email protected]>
Date:   Wed Nov 20 02:37:33 2013 -0300

    Configure: Introduce d_libname_unique

M       Configure

commit adedc077d57a220273128839bbe9b3289fdc5a1f
Author: Brian Fraser <[email protected]>
Date:   Wed May 15 08:52:18 2013 -0300

    DynaLoader: Introduce d_libname_unique
    
    Android's linker has some unusual behavior, in that it only uses
    the basename of a library in its cache.  That means that, as far as
    dlopen() is concerned, the libraries for Hash::Util and List::Util,
    both of which are called Util.so, are the same.
    
    This commit teaches DynaLoader about d_libname_unique.  When
    defined, it signals DynaLoader define a mod2fname sub that renames
    the .so files to something "unique" -- so for example,
    Hash/Util/Util.so becomes Hash/Util/PL_Hash__Util.so.

M       dist/XSLoader/XSLoader_pm.PL
M       ext/DynaLoader/DynaLoader_pm.PL
M       ext/DynaLoader/t/DynaLoader.t
-----------------------------------------------------------------------

Summary of changes:
 Configure                                          | 22 +++++++++++++++
 dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm    |  2 +-
 .../lib/ExtUtils/CBuilder/Base.pm                  | 21 ++++++++++++---
 .../lib/ExtUtils/CBuilder/Platform/Unix.pm         |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/VMS.pm          | 18 +------------
 .../lib/ExtUtils/CBuilder/Platform/Windows.pm      |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm  |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm  |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/aix.pm          |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/cygwin.pm       |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/darwin.pm       |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/dec_osf.pm      |  2 +-
 .../lib/ExtUtils/CBuilder/Platform/os2.pm          |  8 +-----
 dist/ExtUtils-CBuilder/t/01-basic.t                |  2 +-
 dist/ExtUtils-CBuilder/t/03-cplusplus.t            |  2 +-
 dist/XSLoader/XSLoader_pm.PL                       |  6 +++--
 ext/DynaLoader/DynaLoader_pm.PL                    | 30 +++++++++++++++++++--
 ext/DynaLoader/t/DynaLoader.t                      | 31 +++++++++++++++++++++-
 19 files changed, 115 insertions(+), 45 deletions(-)

diff --git a/Configure b/Configure
index f9cbfe7..5cc5f64 100755
--- a/Configure
+++ b/Configure
@@ -575,6 +575,7 @@ d_killpg=''
 d_lchown=''
 d_ldbl_dig=''
 d_libm_lib_version=''
+d_libname_unique=''
 d_link=''
 d_localtime_r=''
 d_localtime_r_needs_tzset=''
@@ -4769,6 +4770,26 @@ rp='What is the file extension used for shared 
libraries?'
 . ./myread
 so="$ans"
 
+: Does target system insist that shared library basenames are unique
+$cat << EOM
+
+Some dynamic loaders assume that the *basename* of shared
+library filenames are globally unique.
+We'll default this to undef as we assume your system is not this
+weird. Set to defined if you're on one of them.
+
+EOM
+
+dflt='n'
+rp='Make shared library basenames unique?'
+. ./myread
+case "$ans" in
+y|Y)    val="$define" ;;
+*)      val="$undef"  ;;
+esac
+set d_libname_unique
+eval $setvar
+
 : Define several unixisms.
 : Hints files or command line option can be used to override them.
 : The convoluted testing is in case hints files set either the old
@@ -22890,6 +22911,7 @@ d_killpg='$d_killpg'
 d_lchown='$d_lchown'
 d_ldbl_dig='$d_ldbl_dig'
 d_libm_lib_version='$d_libm_lib_version'
+d_libname_unique='$d_libname_unique'
 d_link='$d_link'
 d_localtime64='$d_localtime64'
 d_localtime_r='$d_localtime_r'
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm
index 0e3e3fe..860447f 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder.pm
@@ -6,7 +6,7 @@ use File::Basename ();
 use Perl::OSType qw/os_type/;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 $VERSION = eval $VERSION;
 
 # We only use this once - don't waste a symbol table entry on it.
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
index 8014299..26b534c 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm
@@ -10,7 +10,7 @@ use IPC::Cmd qw(can_run);
 use File::Temp qw(tempfile);
 
 use vars qw($VERSION);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 
 # More details about C/C++ compilers:
 # http://developers.sun.com/sunstudio/documentation/product/compiler.jsp
@@ -222,10 +222,23 @@ sub have_cplusplus {
 }
 
 sub lib_file {
-  my ($self, $dl_file) = @_;
+  my ($self, $dl_file, %args) = @_;
   $dl_file =~ s/\.[^.]+$//;
   $dl_file =~ tr/"//d;
-  return "$dl_file.$self->{config}{dlext}";
+  
+  if (defined $args{module_name} and length $args{module_name}) {
+    # Need to create with the same name as DynaLoader will load with.
+    require DynaLoader;
+    if (defined &DynaLoader::mod2fname) {
+      my $lib = DynaLoader::mod2fname([split /::/, $args{module_name}]);
+      my ($dev, $lib_dir, undef) = File::Spec->splitpath($dl_file);
+      $dl_file = File::Spec->catpath($dev, $lib_dir, $lib);
+    }
+  }
+  
+  $dl_file .= ".$self->{config}{dlext}";
+
+  return $dl_file;
 }
 
 
@@ -287,7 +300,7 @@ sub _do_link {
   
   my $objects = delete $args{objects};
   $objects = [$objects] unless ref $objects;
-  my $out = $args{$type} || $self->$type($objects->[0]);
+  my $out = $args{$type} || $self->$type($objects->[0], %args);
   
   my @temp_files;
   @temp_files =
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm
index f4d0c9d..523e9b4 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Unix.pm
@@ -4,7 +4,7 @@ use strict;
 use ExtUtils::CBuilder::Base;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 @ISA = qw(ExtUtils::CBuilder::Base);
 
 sub link_executable {
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm
index 5c815933..79a7139 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/VMS.pm
@@ -4,7 +4,7 @@ use strict;
 use ExtUtils::CBuilder::Base;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 @ISA = qw(ExtUtils::CBuilder::Base);
 
 use File::Spec::Functions qw(catfile catdir);
@@ -118,22 +118,6 @@ sub arg_share_object_file {
   return ("$self->{config}{lddlflags}=$file");
 }
 
-
-sub lib_file {
-  my ($self, $dl_file) = @_;
-  $dl_file =~ s/\.[^.]+$//;
-  $dl_file =~ tr/"//d;
-  $dl_file = $dl_file .= '.' . $self->{config}{dlext};
-
-  # Need to create with the same name as DynaLoader will load with.
-  if (defined &DynaLoader::mod2fname) {
-    my ($dev,$dir,$file) = File::Spec->splitpath($dl_file);
-    $file = DynaLoader::mod2fname([$file]);
-    $dl_file = File::Spec->catpath($dev,$dir,$file);
-  }
-  return $dl_file;
-}
-
 # The following is reproduced almost verbatim from 
ExtUtils::Liblist::Kid::_vms_ext.
 # We can't just call that because it's tied up with the MakeMaker object 
hierarchy.
 
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
index 110906e..84d389f 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows.pm
@@ -10,7 +10,7 @@ use ExtUtils::CBuilder::Base;
 use IO::File;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 @ISA = qw(ExtUtils::CBuilder::Base);
 
 =begin comment
diff --git 
a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm
index f1dc3b8..2c8b196 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/BCC.pm
@@ -1,7 +1,7 @@
 package ExtUtils::CBuilder::Platform::Windows::BCC;
 
 use vars qw($VERSION);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 
 sub format_compiler_cmd {
   my ($self, %spec) = @_;
diff --git 
a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm
index 4e1d677..bc99188 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/GCC.pm
@@ -1,7 +1,7 @@
 package ExtUtils::CBuilder::Platform::Windows::GCC;
 
 use vars qw($VERSION);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 
 sub format_compiler_cmd {
   my ($self, %spec) = @_;
diff --git 
a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
index 3b76757..d5d9d7b 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/Windows/MSVC.pm
@@ -1,7 +1,7 @@
 package ExtUtils::CBuilder::Platform::Windows::MSVC;
 
 use vars qw($VERSION);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 
 sub arg_exec_file {
   my ($self, $file) = @_;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm
index c9621b9..7f92c0c 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm
@@ -5,7 +5,7 @@ use ExtUtils::CBuilder::Platform::Unix;
 use File::Spec;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub need_prelink { 1 }
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm
index 3da133a..d8c3cdb 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm
@@ -5,7 +5,7 @@ use File::Spec;
 use ExtUtils::CBuilder::Platform::Unix;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 # TODO: If a specific exe_file name is requested, if the exe created
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
index 37d50a1..3c83c7d 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
@@ -4,7 +4,7 @@ use strict;
 use ExtUtils::CBuilder::Platform::Unix;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub compile {
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm
index 0d94a64..6246a26 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm
@@ -6,7 +6,7 @@ use File::Spec;
 
 use vars qw($VERSION @ISA);
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 
 sub link_executable {
   my $self = shift;
diff --git a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm 
b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm
index cc4b3ac..f813626 100644
--- a/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm
+++ b/dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/os2.pm
@@ -4,7 +4,7 @@ use strict;
 use ExtUtils::CBuilder::Platform::Unix;
 
 use vars qw($VERSION @ISA);
-$VERSION = '0.280212';
+$VERSION = '0.280213';
 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
 
 sub need_prelink { 1 }
@@ -29,18 +29,12 @@ sub _do_link {
   if ($how eq 'lib_file'
       and (defined $args{module_name} and length $args{module_name})) {
 
-    # DynaLoader::mod2fname() is a builtin func
-    my $lib = DynaLoader::mod2fname([split /::/, $args{module_name}]);
-
     # Now know the basename, find directory parts via lib_file, or objects
     my $objs = ( (ref $args{objects}) ? $args{objects} : [$args{objects}] );
     my $near_obj = $self->lib_file(@$objs);
-    my $ref_file = ( defined $args{lib_file} ? $args{lib_file} : $near_obj );
-    my $lib_dir = ($ref_file =~ m,(.*)[/\\],s ? "$1/" : '' );
     my $exp_dir = ($near_obj =~ m,(.*)[/\\],s ? "$1/" : '' );
 
     $args{dl_file} = $1 if $near_obj =~ m,(.*)\.,s; # put ExportList near OBJ
-    $args{lib_file} = "$lib_dir$lib.$self->{config}{dlext}";   # DLL file
 
     # XXX _do_link does not have place to put libraries?
     push @$objs, $self->perl_inc() . "/libperl$self->{config}{lib_ext}";
diff --git a/dist/ExtUtils-CBuilder/t/01-basic.t 
b/dist/ExtUtils-CBuilder/t/01-basic.t
index 70305af..c910802 100644
--- a/dist/ExtUtils-CBuilder/t/01-basic.t
+++ b/dist/ExtUtils-CBuilder/t/01-basic.t
@@ -44,7 +44,7 @@ ok 1;
 
 is $object_file, $b->compile(source => $source_file);
 
-$lib_file = $b->lib_file($object_file);
+$lib_file = $b->lib_file($object_file, module_name => 'basict');
 ok 1;
 
 my ($lib, @temps) = $b->link(objects => $object_file,
diff --git a/dist/ExtUtils-CBuilder/t/03-cplusplus.t 
b/dist/ExtUtils-CBuilder/t/03-cplusplus.t
index 589495b..e0c21e4 100644
--- a/dist/ExtUtils-CBuilder/t/03-cplusplus.t
+++ b/dist/ExtUtils-CBuilder/t/03-cplusplus.t
@@ -43,7 +43,7 @@ ok 1;
 
 is $object_file, $b->compile(source => $source_file, 'C++' => 1);
 
-$lib_file = $b->lib_file($object_file);
+$lib_file = $b->lib_file($object_file, module_name => 'cplust');
 ok 1;
 
 my ($lib, @temps) = $b->link(objects => $object_file,
diff --git a/dist/XSLoader/XSLoader_pm.PL b/dist/XSLoader/XSLoader_pm.PL
index fb5707c..e382058 100644
--- a/dist/XSLoader/XSLoader_pm.PL
+++ b/dist/XSLoader/XSLoader_pm.PL
@@ -1,5 +1,7 @@
 use strict;
 use Config;
+# We require DynaLoader to make sure that mod2fname is loaded
+eval { require DynaLoader };
 
 1 while unlink "XSLoader.pm";
 open OUT, ">XSLoader.pm" or die $!;
@@ -8,7 +10,7 @@ print OUT <<'EOT';
 
 package XSLoader;
 
-$VERSION = "0.16";
+$VERSION = "0.17";
 
 #use strict;
 
@@ -201,7 +203,7 @@ XSLoader - Dynamically load C libraries into Perl code
 
 =head1 VERSION
 
-Version 0.16
+Version 0.17
 
 =head1 SYNOPSIS
 
diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL
index f0139f9..6c2a3e6 100644
--- a/ext/DynaLoader/DynaLoader_pm.PL
+++ b/ext/DynaLoader/DynaLoader_pm.PL
@@ -85,7 +85,7 @@ package DynaLoader;
 # [email protected], August 1994
 
 BEGIN {
-    $VERSION = '1.22';
+    $VERSION = '1.23';
 }
 
 use Config;
@@ -235,6 +235,32 @@ if ($ENV{PERL_BUILD_EXPAND_CONFIG_VARS} && 
$ENV{PERL_BUILD_EXPAND_ENV_VARS}) {
 EOT
 }
 
+if ( $Config::Config{d_libname_unique} ) {
+    print OUT <<'EOT';
+sub mod2fname {
+    my $parts = shift;
+    my $so_len = length($Config::Config{dlext})+1;
+    my $name_max = 255; # No easy way to get this here
+    
+    my $libname = "PL_" .  join("__", @$parts);
+    
+    return $libname if (length($libname)+$so_len) <= $name_max;
+    
+    # It's too darned big, so we need to go strip. We use the same
+    # algorithm as xsubpp does. First, strip out doubled __
+    $libname =~ s/__/_/g;
+    return $libname if (length($libname)+$so_len) <= $name_max;
+    
+    # Strip duplicate letters
+    1 while $libname =~ s/(.)\1/\U$1/i;
+    return $libname if (length($libname)+$so_len) <= $name_max;
+    
+    # Still too long. Truncate.
+    $libname = substr($libname, 0, $name_max - $so_len);
+    return $libname;
+}
+EOT
+}
 
 # following long string contains $^O-specific stuff, which is factored out
 print OUT expand_os_specific(<<'EOT');
@@ -314,7 +340,7 @@ sub bootstrap {
        next unless -d $dir; # skip over uninteresting directories
        
        # check for common cases to avoid autoload of dl_findfile
-       my $try = "$dir/$modfname.$dl_dlext";
+        my $try = "$dir/$modfname.$dl_dlext";
        last if $file = ($do_expand) ? dl_expandspec($try) : ((-f $try) && 
$try);
        
        # no luck here, save dir for possible later dl_findfile search
diff --git a/ext/DynaLoader/t/DynaLoader.t b/ext/DynaLoader/t/DynaLoader.t
index 1aa8c4e..a95287a 100644
--- a/ext/DynaLoader/t/DynaLoader.t
+++ b/ext/DynaLoader/t/DynaLoader.t
@@ -26,7 +26,7 @@ BEGIN {
     'Time::HiRes'=> q| ::is( ref Time::HiRes->can('usleep'),'CODE' ) |,  # 
5.7.3
 );
 
-plan tests => 22 + keys(%modules) * 3;
+plan tests => 26 + keys(%modules) * 3;
 
 
 # Try to load the module
@@ -155,3 +155,32 @@ for my $libref (reverse @DynaLoader::dl_librefs) {
         }
     }
 }
+
+SKIP: {
+    skip "mod2fname not defined on this platform", 4
+        unless defined &DynaLoader::mod2fname && $Config{d_libname_unique};
+
+    is(
+        DynaLoader::mod2fname(["Hash", "Util"]),
+        "PL_Hash__Util",
+        "mod2fname + libname_unique works"
+    );
+
+    is(
+        DynaLoader::mod2fname([("Hash", "Util") x 25]),
+        "PL_" . join("_", ("Hash", "Util")x25),
+        "mod2fname + libname_unique collapses double __'s for long names"
+    );
+
+    is(
+        DynaLoader::mod2fname([("Haash", "Uttil") x 25]),
+        "PL_" . join("_", ("HAsh", "UTil")x25),
+        "mod2fname + libname_unique collapses repeated characters for long 
names"
+    );
+
+    is(
+        DynaLoader::mod2fname([("Hash", "Util")x30]),
+        substr(("PL_" . join("_", ("Hash", "Util")x30)), 0, 255 - 
(length($Config::Config{dlext})+1)),
+        "mod2fname + libname_unique correctly truncates long names"
+    );
+}

--
Perl5 Master Repository

Reply via email to