Subject: | Installed scripts break after Perl version upgrade |
I'm running Gentoo Linux. It installs Perl as /usr/bin/perl5.8.7 and
makes /usr/bin/perl a symlink to perl5.8.7. I think this is a
reasonably common setup on Unix systems.
If I type "perl -e 'print $^X'", it prints /usr/bin/perl5.8.7. That is
also the path that find_perl_interpreter returns.
The net result of this is that any scripts that are installed by
Module::Build will stop working when you upgrade Perl, because they say
#!/usr/bin/perl5.8.7 instead of #!/usr/bin/perl. I think
find_perl_interpreter ought to be fixed to avoid that.
For my LibA2 distribution, I overrode find_perl_interpreter like this:
use Cwd 'abs_path';
sub find_perl_interpreter
{
my $self = shift @_;
my $perl = $self->SUPER::find_perl_interpreter(@_);
# Convert /usr/bin/perl5.8.6 to /usr/bin/perl:
# (if the latter is a symlink to the former)
my $base = $perl;
if ($base =~ s/[\d.]+$// and -l $base and abs_path($base) eq $perl) {
$perl = $base;
}
return $perl;
} # end find_perl_interpreter
I'm not sure that's the best solution, though. I noticed that "perl
-MConfig -e 'print $Config{perlpath}'" prints /usr/bin/perl. It may be
better to check that instead of just stripping digits off the end.
I was using Module::Build 0.2604 when I discovered this, but version
0.2801 still acts the same way.