perlbrew
fails with Can't locate Devel/PatchPerl.pm
.
More precisely, what fails is a run of patchperl
that is spawned off by perlbrew
.
There is in fact a Devel/PatchPerl.pm
accessible via the paths in the environment variable PERL5LIB
, but perlbrew
unconditionally deletes this variable before it runs perlpatch
:
delete $ENV{$_} for qw(PERL5LIB PERL5OPT);
I can't find anything in the perlbrew
documentation justifying this maneuver.
Can someone explain why perlbrew
does this?
EDIT:
Below is a bash
script that reproduces the problem. I run it like this (with some suitable <PATH_TO_SCRIPT>
):
% env -i HOME=$HOME SHELL=/bin/bash /bin/bash --noprofile --norc
bash-3.2$ /bin/bash --norc --noprofile <PATH_TO_SCRIPT>
The script's running time is about 4 minutes on my machine. The last few lines of output, including the lines showing the error are below:
(cd /tmp/perlbrew_root/build/perl-5.16.3 && rm -f config.sh Policy.sh && patchperl && sh Configure -de '-Dprefix=/tmp/perlbrew_root/perls/perl-5.16.3' '-A'eval:scriptdir=/tmp/perlbrew_root/perls/perl-5.16.3/bin'' && make && make test_harness && make install) 2>&1 | tee /tmp/perlbrew_root/build.perl-5.16.3.log
Can't locate Devel/PatchPerl.pm in @INC (@INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /tmp/testperl/bin/patchperl line 12.
BEGIN failed--compilation aborted at /tmp/testperl/bin/patchperl line 12.
perl-5.16.3 is successfully installed.
The last line of the output above (perl-5.16.3 is successfully installed.
) is nonsense: a real build and installation of perl-5.16.3
would take roughly one order of magnitude longer than this script's running time, which, as already stated, is about 4 minutes on my machine.
Note the @INC
in the error. I don't see how patchperl
could possibly find Devel/PatchPerl.pm
, which is under /tmp/testperl/lib/perl5
, given that @INC
.
PERLDIR=/tmp/testperl
/bin/rm -rf "$PERLDIR"
/bin/rm -rf /tmp/build
/bin/mkdir -p /tmp/build
cd /tmp/build
/usr/bin/curl -s http://www.cpan.org/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz | tar xzf -
pushd local-lib-1.008009
/usr/bin/perl Makefile.PL "--bootstrap=$PERLDIR"
/usr/bin/make install
popd
eval "$( /usr/bin/perl -I$PERLDIR/lib/perl5 -Mlocal::lib=$PERLDIR )"
/usr/bin/cpan App::cpanminus
export PERLBREW_ROOT=/tmp/perlbrew_root
export PERLBREW_HOME=/tmp/perlbrew_home
/bin/rm -rf "$PERLBREW_ROOT" "$PERLBREW_HOME"
$PERLDIR/bin/cpanm App::perlbrew
$PERLDIR/bin/perlbrew init
source "$PERLBREW_ROOT/etc/bashrc"
$PERLDIR/bin/perlbrew install -v perl-5.16.3