From: Craig A. Berry Date: Sun, 29 Jul 2012 17:58:38 +0000 (+0200) Subject: Portability fix-ups for new_from_module() X-Git-Tag: release_1.0.10~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=713aab0e4d5c72ca9e5bac9e33c68ac50d369b52;p=p5sagit%2FModule-Metadata.git Portability fix-ups for new_from_module() This fixes test failures on VMS, and resolves RT #76030. --- diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index e3c12e3..104c41c 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -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 ); }