Fri Jul 25 23:08:02 2014: Request 97519 was acted upon.
Transaction: Ticket created by Hugmeir
       Queue: Module-ScanDeps
     Subject: Fix for t/7-check-dynaloader.t on systems with 
DynaLoader::mod2fname
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: frase...@gmail.com
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=97519 >


Quick explanation: On some systems, DynaLoader defines mod2fname(), which is 
used so that each library has a unique name. This is done because some systems 
(like Windows, Android, and VMS) only the basename of a library is used by the 
linker, which can lead to fairly catastrophic situations; consider Hash::Util 
and List::Util -- both of which usually have a library called Util.so -- end up 
getting the same library loaded, and mayhem occurs. With mod2fname around, 
those two end up being called PL_Hash__Util.so and PL_List__Util.so, which is 
far less likely to clash with anything.

The patch below modifies t/7-check-dynaloader.t so that it'll pass on perls 
where mod2fname is defined.
diff --git a/t/7-check-dynaloader.t b/t/7-check-dynaloader.t
index fda0418..d77873a 100644
--- a/t/7-check-dynaloader.t
+++ b/t/7-check-dynaloader.t
@@ -26,7 +26,9 @@ foreach my $module (@dyna_mods)
 {
     # cf. XSLoader.pm
     my @modparts = split(/::/,$module);
-    my $modfname = $modparts[-1];
+    my $modfname = defined &DynaLoader::mod2fname
+                 ? DynaLoader::mod2fname(\@modparts)
+                 : $modparts[-1];
     my $auto_path = join('/', 'auto', @modparts, 
"$modfname.$Config::Config{dlext}");
 
     check_bundle_path($module, $auto_path, ".pl", <<"...",

Reply via email to