+### On VMS, the ENV is not reset after the program terminates.
+### So reset it here explicitly
+my ($old_env_path, $old_env_perl5lib);
BEGIN {
use FindBin;
use File::Spec;
use Config;
### and add them to the environment, so shellouts get them
- $ENV{'PERL5LIB'} = join ':',
+ $old_env_perl5lib = $ENV{'PERL5LIB'};
+ $ENV{'PERL5LIB'} = join ':',
grep { defined } $ENV{'PERL5LIB'}, @paths, @rel2abs;
### add our own path to the front of $ENV{PATH}, so that cpanp-run-perl
### and friends get picked up
- $ENV{'PATH'} = join $Config{'path_sep'},
+ $old_env_path = $ENV{PATH};
+ $ENV{'PATH'} = join $Config{'path_sep'},
grep { defined } "$FindBin::Bin/../bin", $ENV{'PATH'};
### Fix up the path to perl, as we're about to chdir
$IPC::Cmd::USE_IPC_RUN = 0 if $^O eq 'MSWin32';
}
+### Use a $^O comparison, as depending on module at this time
+### may cause weird errors/warnings
+END {
+ if ($^O eq 'VMS') {
+ ### VMS environment variables modified by this test need to be put back
+ ### 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;
+
+ if (defined $old_perl5lib) {
+ $ENV{PERL5LIB} = $old_perl5lib;
+ } else {
+ delete $ENV{PERL5LIB};
+ }
+ }
+}
+
use strict;
use CPANPLUS::Configure;
use CPANPLUS::Error ();
$Locale::Maketext::Lexicon::VERSION = 0;
}
+my $Env = 'PERL5_CPANPLUS_TEST_VERBOSE';
+
# prereq has to be in our package file && core!
use constant TEST_CONF_PREREQ => 'Cwd';
use constant TEST_CONF_MODULE => 'Foo::Bar::EU::NOXS';
+use constant TEST_CONF_AUTHOR => 'EUNOXS';
use constant TEST_CONF_INST_MODULE => 'Foo::Bar';
use constant TEST_CONF_INVALID_MODULE => 'fnurk';
use constant TEST_CONF_MIRROR_DIR => 'dummy-localmirror';
+use constant TEST_CONF_CPAN_DIR => 'dummy-CPAN';
### we might need this Some Day when we're installing into
### our own sandbox. see t/20.t for details
### for our test suite. Bug [perl #43629] showed this.
my $conf = CPANPLUS::Configure->new( load_configs => 0 );
$conf->set_conf( hosts => [ {
- path => 'dummy-CPAN',
+ path => File::Spec->rel2abs(TEST_CONF_CPAN_DIR),
scheme => 'file',
} ],
);
$conf->set_conf( base => 'dummy-cpanplus' );
$conf->set_conf( dist_type => '' );
$conf->set_conf( signature => 0 );
+ $conf->set_conf( verbose => 1 ) if $ENV{ $Env };
+
+ ### never use a pager in the test suite
+ $conf->set_program( pager => '' );
### dmq tells us that we should run with /nologo
### if using nmake, as it's very noise otherwise.
sub output_file { return $file }
- my $env = 'PERL5_CPANPLUS_TEST_VERBOSE';
+
### redirect output from msg() and error() output to file
- unless( $ENV{$env} ) {
+ unless( $ENV{$Env} ) {
print "# To run tests in verbose mode, set ".
- "\$ENV{PERL5_CPANPLUS_TEST_VERBOSE} = 1\n" unless $ENV{PERL_CORE};
+ "\$ENV{$Env} = 1\n" unless $ENV{PERL_CORE};
- unlink $file; # just in case
+ 1 while unlink $file; # just in case
$CPANPLUS::Error::ERROR_FH =
$CPANPLUS::Error::ERROR_FH = output_handle();
}
}
-
-
### whenever we start a new script, we want to clean out our
### old files from the test '.cpanplus' dir..
sub _clean_test_dir {
my $path = File::Spec->catfile( $dir, $file );
+ ### John Malmberg reports yet another VMS issue:
+ ### A directory name on VMS in VMS format ends with .dir
+ ### when it is referenced as a file.
+ ### In UNIX format traditionally PERL on VMS does not remove the
+ ### '.dir', however the VMS C library conversion routines do remove
+ ### the '.dir' and the VMS C library routines can not handle the
+ ### '.dir' being present on UNIX format filenames.
+ ### So code doing the fixup has on VMS has to be able to handle both
+ ### UNIX format names and VMS format names.
+ ### 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 );
+
### directory, rmtree it
if( -d $path ) {
print "# Deleting directory '$path'\n" if $verbose;