building modules that use Module::Install
"Craig A. Berry" <[email protected]> Fri, 26 Oct 2012 09:05:04 -0500
| Newsgroups | gmane.comp.lang.perl.ports.vms |
|---|---|
| Message-ID | <[email protected]> |
An irritant of long standing has been the fact that many Perl modules on CPAN use Module::Install in their Makefile.PL's but Module::Install has been non-functional on VMS for some time, making the modules that use it impossible to build without rewriting the Makefile.PL or other extreme measures. I finally got to the bottom of the portability problems and submitted a fix at <https://rt.cpan.org/Public/Bug/Display.html?id=79858>. There are 67 tickets in that queue and I have no idea when or if mine will be accepted, and the unfortunate design of Module::Install means that a until there is a new release with that fix in place and each and every module author has upgraded to the new version, we're no further along than we were before. This because Module::Install embeds a copy of itself in each and every module that uses it, so until the copy gets updated, the existence of a new version doesn't do us any good with any particular module. But all is not lost, since you can simply fix the embedded copy of Module::Install for whatever extension you're trying to build. The attached patch will do just that. It's equivalent to the patch I submitted upstream, except it's against the local copy of Module::Install in [.inc] instead of the one [.lib]. Happy module building. ________________________________________ Craig A. Berry mailto:[email protected] "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser
mi.patch
(application/octet-stream, 1.9 KB)
--- inc/Module/Install.pm.orig 2012-09-03 11:40:44 -0500
+++ inc/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;
}
--- inc/Module/Install/Can.pm;-0 2012-09-03 11:38:43 -0500
+++ inc/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