From b5fe401bfa4db89e5f67b4efa27cfb15826a0dcc Mon Sep 17 00:00:00 2001 From: "Michael G. Schwern" Date: Thu, 6 Dec 2001 17:45:44 -0500 Subject: which_perl for safer $^Xing Message-ID: <20011207034544.GN22648@blackrider> (plus op/ref tweak) p4raw-id: //depot/perl@13506 --- t/test.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 't/test.pl') 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; -- cgit v1.2.1