Subject: | [PATCH] portability fix-ups for new_from_module() |
When 1.000009 came into blead, the new tests failed on VMS. The attached patch fixes those
and gets the tests passing again.
One problem was that there is an abs2rel call that assumed the input filespec would be in native
syntax, but it's not -- we're explicitly using slashes in filenames, so we need to use
File::Spec::Unix->abs2rel().
The other problem is that divining package names from filenames doesn't work so well when
filename case is not preserved. The patch partially addresses that by correcting the case of the
primary package name and the stashed filename from the package name read from the file.
Subject: | metadata.patch |
--- lib/Module/Metadata.pm;-0 2012-02-08 13:54:14 -0600
+++ lib/Module/Metadata.pm 2012-03-24 22:35:36 -0500
@@ -219,7 +219,7 @@ sub new_from_module {
# separating into primary & alternative candidates
my( %prime, %alt );
foreach my $file (@files) {
- my $mapped_filename = File::Spec->abs2rel( $file, $dir );
+ my $mapped_filename = File::Spec::Unix->abs2rel( $file, $dir );
my @path = split( /\//, $mapped_filename );
(my $prime_package = join( '::', @path )) =~ s/\.pm$//;
@@ -232,10 +232,12 @@ sub new_from_module {
my $version = $pm_info->version( $package );
+ $prime_package = $package if lc($prime_package) eq lc($package);
if ( $package eq $prime_package ) {
if ( exists( $prime{$package} ) ) {
croak "Unexpected conflict in '$package'; multiple versions found.\n";
} else {
+ $mapped_filename = "$package.pm" if lc("$package.pm") eq lc($mapped_filename);
$prime{$package}{file} = $mapped_filename;
$prime{$package}{version} = $version if defined( $version );
}