diff options
author | Michael G. Schwern <schwern@pobox.com> | 2001-12-06 17:45:44 -0500 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-12-07 03:05:38 +0000 |
commit | b5fe401bfa4db89e5f67b4efa27cfb15826a0dcc (patch) | |
tree | 6b62dc61e7583356a0d8ed4b8f4f31730ce1e7e9 /t/test.pl | |
parent | 394e6ffb59de984c27a7dce4842d9c594c141888 (diff) | |
download | perl-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.pl | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -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; |