With the attached changes to DistGen, we can actually run all the tests, and with the changes to Module::Build::Base, we get one step closer to doing some basic things like running Perl one-liners. After this and the CBuilder patch just posted, I get the following Module::Build results:
Failed 9/20 test scripts, 55.00% okay. 139/603 subtests failed, 76.95% okay. which is a lot better than the 17/20 before the patch. Obviously there is quite a bit more to do, though.
--- lib/Module/Build/Base.pm;-0 Sun Mar 12 07:50:59 2006 +++ lib/Module/Build/Base.pm Sun Mar 12 16:00:58 2006 @@ -315,9 +315,22 @@ sub cwd { return Cwd::cwd(); } +sub _quote_args { + my ($self, $arglist) = @_; + + my $return_args = ''; + my @args = ( ref($arglist) ? @$arglist : (split /\s+/, $arglist) ); + for (@args) { + $return_args .= q( ").$_.q(") if !/^\"/ && length($_) > 0; + } + return $return_args; +} + sub _perl_is_same { my ($self, $perl) = @_; - return `$perl -MConfig=myconfig -e print -e myconfig` eq Config->myconfig; + my $argstr = '-MConfig=myconfig -e print -e myconfig'; + $argstr = $self->_quote_args($argstr) if $self->os_type eq 'VMS'; + return `$perl $argstr` eq Config->myconfig; } sub find_perl_interpreter { @@ -2015,7 +2028,7 @@ sub process_script_files { foreach my $file (keys %$files) { my $result = $self->copy_if_modified($file, $script_dir, 'flatten') or next; - $self->fix_shebang_line($result); + $self->fix_shebang_line($result) unless $self->os_type eq 'VMS'; $self->make_executable($result); } } @@ -2102,6 +2115,7 @@ sub _find_file_by_type { sub localize_file_path { my ($self, $path) = @_; + $path =~ s/\.\z// if $self->os_type eq 'VMS'; return File::Spec->catfile( split m{/}, $path ); } @@ -3632,6 +3646,7 @@ sub run_perl_command { # this before documenting. my ($self, $args) = @_; $args = [ $self->split_like_shell($args) ] unless ref($args); + $args = [ split(/\s+/, $self->_quote_args($args)) ] if $self->os_type eq 'VMS'; my $perl = ref($self) ? $self->perl : $self->find_perl_interpreter; # Make sure our local additions to @INC are propagated to the subprocess --- lib/Module/Build/t/lib/DistGen.pm;-0 Mon Mar 6 10:12:13 2006 +++ lib/Module/Build/t/lib/DistGen.pm Sun Mar 12 14:11:56 2006 @@ -16,6 +16,14 @@ use File::Spec (); use IO::File (); use Tie::CPHash; +BEGIN { + if( $^O eq 'VMS' ) { + # For things like vmsify() + require VMS::Filespec; + VMS::Filespec->import; + } +} + sub new { my $package = shift; my %options = @_; @@ -309,7 +317,11 @@ sub clean { File::Find::finddepth( sub { my $name = File::Spec->canonpath( $File::Find::name ); - $name =~ s/\.\z// if $^O eq 'VMS'; + if ($^O eq 'VMS') { + $name =~ s/\.\z//; + $name = vmspath($name) if -d $name; + $name = File::Spec->rel2abs($name) if $name eq File::Spec->curdir(); + } if ( not exists $names{$name} ) { print "Removing '$name'\n" if $VERBOSE; @@ -322,7 +334,7 @@ sub clean { sub remove { my $self = shift; - File::Path::rmtree( $self->dirname ); + File::Path::rmtree( File::Spec->canonpath($self->dirname) ); } sub revert {