Subject: | Fix for t/7-check-dynaloader.t on systems with DynaLoader::mod2fname |
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", <<"...",