summaryrefslogtreecommitdiff
path: root/t/test.pl
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2001-12-06 17:45:44 -0500
committerJarkko Hietaniemi <jhi@iki.fi>2001-12-07 03:05:38 +0000
commitb5fe401bfa4db89e5f67b4efa27cfb15826a0dcc (patch)
tree6b62dc61e7583356a0d8ed4b8f4f31730ce1e7e9 /t/test.pl
parent394e6ffb59de984c27a7dce4842d9c594c141888 (diff)
downloadperl-b5fe401bfa4db89e5f67b4efa27cfb15826a0dcc.tar.gz
which_perl for safer $^Xing
Message-ID: <20011207034544.GN22648@blackrider> (plus op/ref tweak) p4raw-id: //depot/perl@13506
Diffstat (limited to 't/test.pl')
-rw-r--r--t/test.pl24
1 files changed, 24 insertions, 0 deletions
diff --git a/t/test.pl b/t/test.pl
index 5ed6c821b8..ca4af688dc 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -263,4 +263,28 @@ sub BAILOUT {
}
+# A somewhat safer version of the sometimes wrong $^X.
+BEGIN: {
+ eval {
+ require File::Spec;
+ require Config;
+ Config->import;
+ };
+ warn "test.pl had problems loading other modules: $@" if $@;
+}
+
+# We do this at compile time before the test might have chdir'd around
+# and make sure its absolute in case they do later.
+my $Perl = $^X;
+$Perl = File::Spec->rel2abs(File::Spec->catfile(File::Spec->curdir(), $Perl))
+ if $^X eq "perl$Config{_exe}";
+warn "Can't generate which_perl from $^X" unless -f $Perl;
+
+# For subcommands to use.
+$ENV{PERLEXE} = $Perl;
+
+sub which_perl {
+ return $Perl;
+}
+
1;