本文介绍了perlbrew 失败并显示“无法找到 Devel/PatchPerl.pm";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

perlbrew 失败,Can't locate Devel/PatchPerl.pm.

更准确地说,失败的是由 perlbrew 生成的 patchperl 运行.

More precisely, what fails is a run of patchperl that is spawned off by perlbrew.

实际上是一个Devel/PatchPerl.pm,可以通过环境变量PERL5LIB中的路径访问,但是perlbrew 在它运行之前无条件地删除这个变量perlpatch:

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);

我在 perlbrew 文档中找不到任何证明这种操作的合理性.

I can't find anything in the perlbrew documentation justifying this maneuver.

有人可以解释为什么 perlbrew 这样做吗?

Can someone explain why perlbrew does this?

下面是重现问题的 bash 脚本.我像这样运行它(使用一些合适的 ):

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>

脚本在我的机器上的运行时间约为 4 分钟.输出的最后几行,包括显示错误的行如下:

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.

上面输出的最后一行(perl-5.16.3 已成功安装.)是无稽之谈:perl-5.16.3 的真正构建和安装将比这个脚本的运行时间长大约一个数量级,如前所述,在我的机器上大约需要 4 分钟.

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.

注意错误中的 @INC.我不知道 patchperl 怎么可能找到 Devel/PatchPerl.pm,它在 /tmp/testperl/lib/perl5 下,给定那个@INC.

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

推荐答案

Upgrade perlbrew (perlbrew self-upgradehttp://perlbrew.pl/).

Upgrade perlbrew (perlbrew self-upgrade or the shell bootstrap incantation from http://perlbrew.pl/).

最近的版本通过 perlbrew install-patchperl 将 patchperl 安装到 $PERLBREW_ROOT/bin.

Recent versions install patchperl into $PERLBREW_ROOT/bin through perlbrew install-patchperl.

这篇关于perlbrew 失败并显示“无法找到 Devel/PatchPerl.pm";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 16:48