Skip Menu |

This queue is for tickets about the Module-Install CPAN distribution.

Report information
The Basics
Id: 79858
Status: new
Priority: 0/
Queue: Module-Install

People
Owner: Nobody in particular
Requestors: cberry [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.06
Fixed in: (no value)



Subject: [PATCH] build help for VMS
After a long hiatus, I got Module::Install working on VMS again. The attached patch does the following things. 1.) The new() method does various things with $base_path that assume it is in Unix format. On VMS, it isn't unless we make it so, so make it so. 2.) In find_extensions, set no_chdir for File::Find because various things change the current working directory out from underneath us. 3.) In find_extensions, when reading the contents of a package in order to correct the case of the package name, split on lines instead of characters because not many package names are only one character long. 4.) In Module::Install::Can::can_cc(), just use ExtUtils::CBuilder on VMS to determine whether we have a C compiler instead of the existing, hopelessly non-portable method. It seems like this should be done on all platforms, but perhaps there is a version dependency.
Subject: mi_vms.patch
--- lib/Module/Install.pm.orig 2012-09-03 11:40:44 -0500 +++ lib/Module/Install.pm 2012-09-21 16:19:55 -0500 @@ -244,6 +244,8 @@ sub new { } return $args{_self} if $args{_self}; + $base_path = VMS::Filespec::unixify($base_path) if $^O eq 'VMS'; + $args{dispatch} ||= 'Admin'; $args{prefix} ||= 'inc'; $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); @@ -322,7 +325,7 @@ sub find_extensions { my ($self, $path) = @_; my @found; - File::Find::find( sub { + File::Find::find( {no_chdir => 1, wanted => sub { my $file = $File::Find::name; return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; my $subpath = $1; @@ -336,9 +339,9 @@ sub find_extensions { # correctly. Otherwise, root through the file to locate the case-preserved # version of the package name. if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { - my $content = Module::Install::_read($subpath . '.pm'); + my $content = Module::Install::_read($File::Find::name); my $in_pod = 0; - foreach ( split //, $content ) { + foreach ( split /\n/, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text @@ -351,7 +354,7 @@ sub find_extensions { } push @found, [ $file, $pkg ]; - }, $path ) if -d $path; + }}, $path ) if -d $path; @found; } --- lib/Module/Install/Can.pm;-0 2012-09-03 11:38:43 -0500 +++ lib/Module/Install/Can.pm 2012-09-21 17:07:15 -0500 @@ -121,6 +121,15 @@ END_C # Can we locate a (the) C compiler sub can_cc { my $self = shift; + + if ($^O eq 'VMS') { + require ExtUtils::CBuilder; + my $builder = ExtUtils::CBuilder->new( + quiet => 1, + ); + return $builder->have_compiler; + } + my @chunks = split(/ /, $Config::Config{cc}) or return; # $Config{cc} may contain args; try to find out the program part