This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: CPANPLUS conf.pl fixes for VMS
authorJohn E. Malmberg <wb8tyw@qsl.net>
Sun, 11 Nov 2007 22:08:08 +0000 (16:08 -0600)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 12 Nov 2007 14:38:17 +0000 (14:38 +0000)
From: "John E. Malmberg" <wb8tyw@qsl.net>
Message-id: <4737D1A8.8010601@qsl.net>

p4raw-id: //depot/perl@32284

lib/CPANPLUS/Config.pm
lib/CPANPLUS/Dist/Build/t/inc/conf.pl
lib/CPANPLUS/t/inc/conf.pl

index f9f5391..89de280 100644 (file)
@@ -555,17 +555,17 @@ with CPANPLUS, which is used to enable autoflushing in spawned processes.
 
             my $path;
             BIN: for my $bin (@bins) {
-                
+
                 ### parallel to your cpanp/cpanp-boxed
                 my $maybe = File::Spec->rel2abs(
-                                File::Spec->catdir( dirname($0), $bin )
+                                File::Spec->catfile( dirname($0), $bin )
                             );        
                 $path = $maybe and last BIN if -f $maybe;
         
                 ### parallel to your CPANPLUS.pm:
                 ### $INC{cpanplus}/../bin/cpanp-run-perl
                 $maybe = File::Spec->rel2abs(
-                            File::Spec->catdir
+                            File::Spec->catfile
                                 dirname($INC{'CPANPLUS.pm'}),
                                 '..',   # lib dir
                                 'bin',  # bin dir
@@ -580,7 +580,7 @@ with CPANPLUS, which is used to enable autoflushing in spawned processes.
                 ### CPANPLUS.pm in
                 ### /tmp/cp/lib/perl5/site_perl/5.8.8
                 $maybe = File::Spec->rel2abs(
-                            File::Spec->catdir
+                            File::Spec->catfile
                                 dirname( $INC{'CPANPLUS.pm'} ),
                                 '..', '..', '..', '..', # 4x updir
                                 'bin',                  # bin dir
@@ -599,6 +599,11 @@ with CPANPLUS, which is used to enable autoflushing in spawned processes.
                              split(/\Q$Config::Config{path_sep}\E/, $ENV{PATH}),
                              File::Spec->curdir, 
                 ) {             
+
+                    ### On VMS the path could be in UNIX format, and we
+                    ### currently need it to be in VMS format
+                    $dir = VMS::Filespec::vmspath($dir) if ON_VMS;
+
                     $maybe = File::Spec->catfile( $dir, $bin );
                     $path = $maybe and last BIN if -f $maybe;
                 }
index f7179e0..bd75428 100644 (file)
@@ -31,7 +31,7 @@ BEGIN {
     ### and friends get picked up
     $old_env_path = $ENV{PATH};
     $ENV{'PATH'}  = join $Config{'path_sep'}, 
-                    grep { defined } "$FindBin::Bin/../bin", $ENV{'PATH'};
+                    grep { defined } "$FindBin::Bin/../../../bin", $ENV{'PATH'};
 
     ### Fix up the path to perl, as we're about to chdir
     ### but only under perlcore, or if the path contains delimiters,
@@ -62,10 +62,10 @@ END {
         ### path is "magic" on VMS, we can not tell if it really existed before
         ### this was run, because VMS will magically pretend that a PATH
         ### environment variable exists set to the current working directory
-        $ENV{PATH} = $old_path;
+        $ENV{PATH} = $old_env_path;
 
-        if (defined $old_perl5lib) {
-            $ENV{PERL5LIB} = $old_perl5lib;
+        if (defined $old_env_perl5lib) {
+            $ENV{PERL5LIB} = $old_env_perl5lib;
         } else {
             delete $ENV{PERL5LIB};
         }
@@ -127,16 +127,20 @@ sub _clean_test_dir {
             ### XXX See http://www.xray.mpe.mpg.de/
             ### mailing-lists/perl5-porters/2007-10/msg00064.html
             ### for details -- the below regex could use some touchups
-            ### according to John. M.            
-            $file =~ s/\.dir//i if $^O eq 'VMS';
-            
-            my $dirpath = File::Spec->catdir( $dir, $file );
-            
+            ### according to John. M.
+
             ### directory, rmtree it
             if( -d $path ) {
-                print "# Deleting directory '$path'\n" if $verbose;
-                eval { rmtree( $path ) };
-                warn "Could not delete '$path' while cleaning up '$dir'" if $@;
+
+                $file =~ s/\.dir$//i if $^O eq 'VMS';
+
+                ### Need a path specification here, not a file.
+                my $dirpath = File::Spec->catdir( $dir, $file );
+
+                print "# Deleting directory '$dirpath'\n" if $verbose;
+                eval { rmtree( $dirpath ) };
+                warn "Could not delete '$dirpath' while cleaning up '$dir'"
+                    if $@;
            
             ### regular file
             } else {
index fe6a20f..ba1b002 100644 (file)
@@ -62,10 +62,10 @@ END {
         ### path is "magic" on VMS, we can not tell if it really existed before
         ### this was run, because VMS will magically pretend that a PATH
         ### environment variable exists set to the current working directory
-        $ENV{PATH} = $old_path;
+        $ENV{PATH} = $old_env_path;
 
-        if (defined $old_perl5lib) {
-            $ENV{PERL5LIB} = $old_perl5lib;
+        if (defined $old_env_perl5lib) {
+            $ENV{PERL5LIB} = $old_env_perl5lib;
         } else {
             delete $ENV{PERL5LIB};
         }
@@ -272,7 +272,7 @@ sub _clean_test_dir {
                 ### mailing-lists/perl5-porters/2007-10/msg00064.html
                 ### for details -- the below regex could use some touchups
                 ### according to John. M.            
-                $file =~ s/\.dir//i if $^O eq 'VMS';
+                $file =~ s/\.dir$//i if $^O eq 'VMS';
                 
                 my $dirpath = File::Spec->catdir( $dir, $file );