perlbrew
失败Can't locate Devel/PatchPerl.pm
。
更准确地说,失败的是patchperl
由perlbrew
.
实际上可以Devel/PatchPerl.pm
通过环境变量中的路径访问,PERL5LIB
但在运行之前perlbrew
无条件地删除perlpatch
此变量:
delete $ENV{$_} for qw(PERL5LIB PERL5OPT);
我在文档中找不到任何perlbrew
证明这种做法的理由。
有人可以解释为什么perlbrew
会这样吗?
编辑:
下面是bash
重现该问题的脚本。我像这样运行它(有一些合适的<PATH_TO_SCRIPT>
):
% env -i HOME=$HOME SHELL=/bin/bash /bin/bash --noprofile --norc
bash-3.2$ /bin/bash --norc --noprofile <PATH_TO_SCRIPT>
该脚本在我的机器上的运行时间约为 4 分钟。输出的最后几行,包括显示错误的行如下:
(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.
perl-5.16.3 is successfully installed.
上面输出的最后一行perl-5.16.3
(
注意@INC
错误中的。patchperl
鉴于. _ Devel/PatchPerl.pm
_ /tmp/testperl/lib/perl5
_@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