An update to the Module/Build/Platform/VMS.pm patch.

This saves and restores the environment variable HARNESS_PERL_SWITCHES.

After multiple runs of xs.t, this was ending up with garbage in it.

I still have not figured out what is wrong with xs.t.

-John
[EMAIL PROTECTED]
Personal Opinion Only
--- /rsync_root/perl/lib/Module/Build/Platform/VMS.pm   Thu Oct 25 04:50:40 2007
+++ lib/Module/Build/Platform/VMS.pm    Sun Nov 11 22:58:50 2007
@@ -5,6 +5,7 @@
 $VERSION = '0.2808_01';
 $VERSION = eval $VERSION;
 use Module::Build::Base;
+use Env;
 
 use vars qw(@ISA);
 @ISA = qw(Module::Build::Base);
@@ -136,7 +137,9 @@
                    ? 1 
                    : 0;
 
-  map { $_ = q(").$_.q(") if !/^\"/ && length($_) > 0 }
+  # Do not quote qualifiers that begin with '/' or already
+  # quoted arguments.
+  map { $_ = q(").$_.q(") if !/^[\"|\/]/ && length($_) > 0 }
      ($got_arrayref ? @{$args[0]} 
                     : @args
      );
@@ -304,6 +307,7 @@
 
         # Trivial case of just ~ by it self
         if ($spec eq '') {
+            $home =~ s#/$##;
             return $home;
         }
 
@@ -336,6 +340,7 @@
             $newdirs = File::Spec::Unix->catdir(@hdirs, @backup, @dirs);
 
         }
+        $newdirs =~ s#/$##;
         
         # Now put the two cases back together
         $arg = File::Spec::Unix->catpath($hvol, $newdirs, $file);
@@ -357,7 +362,55 @@
 
 sub find_perl_interpreter { return $^X; }
 
+=item localize_file_path
+
+Convert the file path to the local syntax
+
+=cut
+
+sub localize_file_path {
+  my ($self, $path) = @_;
+  $path =~ s/\.\z//;
+  return VMS::Filespec::vmsify($path);
+}
+
+=item localize_dir_path
+
+Convert the directory path to the local syntax
+
+=cut
+
+sub localize_dir_path {
+  my ($self, $path) = @_;
+  return VMS::Filespec::vmspath($path);
+}
+
 =back
+
+=head2 initialization and cleanup
+
+Need to save and restore the state of the HARNESS_PERL_SWITCHES
+
+=cut
+
+my $old_env_harness_perl_switches;
+
+BEGIN {
+
+    # Get the old value
+    $old_env_harness_perl_switches = $ENV{HARNESS_PERL_SWITCHES};
+}
+
+END {
+
+    # put it back or remove it.
+    if (defined $old_env_harness_perl_switches) {
+        $ENV{HARNESS_PERL_SWITCHES} = $old_env_harness_perl_switches;
+    } else {
+        delete $ENV{HARNESS_PERL_SWITCHES};
+    }
+}
+
 
 =head1 AUTHOR
 

Reply via email to