Re: Installation when "perl" is perl4 and "perl5" is the perl we want
Andreas Koenig (k@anna.mind.de)
Wed, 20 Sep 1995 14:37:19 +0200
>>>>> "Gisle" == Gisle Aas <aas@oslonett.no> writes:
Gisle> Many systems are still set up with "perl" as perl4.036 and
Gisle> "perl5" as the latest and greatest perl version. This
Gisle> creates two problems for LWP installation:
Gisle> The MakeFile.PL line:
Gisle> chop($hash{VERSION} = `perl VERSION`);
At least in this respect MakeMaker 4.18 has improvedover 4.16 which
comes with 5.001m. But that won't help you now. You can borrow the
code how perl5 is found from there. Here it goes:
sub find_perl{
my($self, $ver, $names, $dirs, $trace) = @_;
my($name, $dir);
if ($trace >= 2){
print "Looking for perl $ver by these names: ";
print "@$names, ";
print "in these dirs:";
print "@$dirs";
}
foreach $dir (@$dirs){
next unless defined $dir; # $att{PERL_SRC} may be undefined
foreach $name (@$names){
my $abs;
if ($name =~ m|^/|) {
$abs = $name;
} else {
$abs = MY->catfile($dir, $name);
}
print "Checking $abs " if ($trace >= 2);
next unless -x "$abs";
print "Executing $abs" if ($trace >= 2);
if (`$abs -e 'require $ver; print "VER_OK\n" ' 2>&1` =~ /VER_OK/) {
print "Using PERL=$abs" if $trace;
return $abs;
}
}
}
print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
0; # false and not empty
}
MY->catfile is just a join "/". It's there for VMS.
And is used like so:
% perl -le '
use ExtUtils::MakeMaker;
print MM_Unix->find_perl(5.0, [ $^X, "miniperl","perl","perl5","perl$]" ],
[split ":", $ENV{PATH}],0);'
Yes, $^X is o.k. under these circumstances, because the subroutine is
paranoid enough to accept nothing but perl5 (courtesy Tim Bunce).
This function was never intended to be public, so for now you better
copy it to your Makefile.PL to give me freedom to change the class
structure. Time will tell, how I will make it available later.
Cordially,
andreas