Permalink
Browse files

Portability for my::bundles.

On VMS readdir() by default returns directory names with the .DIR
extension, which needs to be trimmed off if the directory name is
going to be glued together with other pieces to make a path.

Also on VMS, filename case is not preserved by default, so we need
to do a case-blind lookup of Scalar-List-Utils to trigger its
special handling.
  • Loading branch information...
craigberry committed Nov 5, 2011
1 parent 54ee299 commit c6a1f63b04c3a3a6754bb37516f80235929fffa3
Showing with 6 additions and 2 deletions.
  1. +6 −2 my/bundles.pm
View
@@ -34,7 +34,7 @@ inc/ as a flattened module directory that MakeMaker can install.
my $bundle_dir = "bundled";
my %special_dist = (
- "Scalar-List-Utils" => sub {
+ "scalar-list-utils" => sub {
# Special case for Scalar::Util, never override the XS version with a
# pure Perl version. Just check that it's there.
my $installed = find_installed("Scalar/Util.pm");
@@ -50,6 +50,9 @@ my %special_dist = (
sub add_bundles_to_inc {
opendir my $dh, $bundle_dir or die "Can't open bundles directory: $!";
my @bundles = grep { -d $_ } map { "$bundle_dir/$_" } grep !/^\./, readdir $dh;
+ if ($^O eq 'VMS') {
+ for my $bundle (@bundles) { $bundle =~ s/\.DIR$//i; }
+ }
require lib;
lib->import(@bundles);
@@ -69,7 +72,8 @@ sub copy_bundles {
opendir my $bundle_dh, $src or die $!;
for my $dist (grep !/^\./, grep { -d File::Spec->catdir($src, $_) } readdir $bundle_dh) {
- my $should_use = $special_dist{$dist} || \&should_use_dist;
+ $dist =~ s/.DIR$//i if $^O eq 'VMS';
+ my $should_use = $special_dist{lc($dist)} || \&should_use_dist;
next unless $should_use->($dist);

0 comments on commit c6a1f63

Please sign in to comment.