9 # Setup the code to clean out %ENV
11 # Environment variables which might effect our testing
12 my @delete_env_keys = qw(
25 # Remember the ENV values because on VMS %ENV is global
26 # to the user, not the process.
30 for my $key (@delete_env_keys) {
31 if( exists $ENV{$key} ) {
32 $restore_env_keys{$key} = delete $ENV{$key};
41 while( my($key, $val) = each %restore_env_keys ) {
51 # In case the test wants to use our other bundled
52 # modules, make sure they can be loaded.
53 my $t_lib = File::Spec->catdir('t', 'bundled');
54 push @INC, $t_lib; # Let user's installed version override
56 if ($ENV{PERL_CORE}) {
57 # We change directories, so expand @INC and $^X to absolute paths
59 @INC = (map(File::Spec->rel2abs($_), @INC), ".");
60 $^X = File::Spec->rel2abs($^X);
66 ########################################################################
68 # always return to the current directory
70 my $cwd = File::Spec->rel2abs(Cwd::cwd);
72 sub original_cwd { return $cwd }
75 # Go back to where you came from!
76 chdir $cwd or die "Couldn't chdir to $cwd";
79 ########################################################################
81 # Setup a temp directory
83 my ($self, @args) = @_;
84 my $dir = $ENV{PERL_CORE} ? MBTest->original_cwd : File::Spec->tmpdir;
85 return File::Temp::tempdir('MB-XXXXXXXX', CLEANUP => 1, DIR => $dir, @args);
89 $ENV{HOME} = tmpdir; # don't want .modulebuildrc or other things interfering
93 # vim:ts=2:sw=2:et:sta