如何使用 perlbrew 在我家安装 Perl 版本?
我已经安装了 perlbrew 这似乎是一个很好的解决方案,但我得到实际尝试安装某些 Perl 版本时出现一些无意义的错误:
$ perlbrew install perl-5.12.1
Attempting to load conf from /home/dave/perl5/perlbrew/Conf.pm
Fail to get http://search.cpan.org/dist/perl-5.12.1 (error: ) at /home/dave/perl5/perlbrew/bin/perlbrew line 1277.
I have installed perlbrew which seems like a good solution, but I get some meaningless error when actually trying to install some Perl version:
$ perlbrew install perl-5.12.1
Attempting to load conf from /home/dave/perl5/perlbrew/Conf.pm
Fail to get http://search.cpan.org/dist/perl-5.12.1 (error: ) at /home/dave/perl5/perlbrew/bin/perlbrew line 1277.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的评论,您的 shell 中是否设置了
http_proxy
ENV 变量?如果没有,则使用您的代理设置进行设置,然后重试 perlbrew 安装:
perlbrew
使用此 ENV 变量来获取代理服务器。如果未设置此 ENV 变量,则会尝试正常的直接 HTTP 连接(请参阅 Github 上 perlbrew 当前 master 中的第 1274 行)如果这不起作用,请查看
HTTP::Lite
。这就是perlbrew
在后台使用的内容来获取源代码。 注意。 perlbrew 使用自己的 HTTP::Lite 副本最后,如果仍然不走运,您提到您通过 CPAN“首先安装了它”。该文档确实提到了从以前的 CPAN 版本升级时出现的问题。这也许是您需要进一步研究的事情?
更新测试此
HTTP::Lite
脚本并让我知道您看到的内容(注意。您可能需要安装 < code>HTTP::Lite):我认为您可能遇到了
HTTP::Lite
,请参阅 RT 问题 uri 样式代理环境变量无法正确设置代理和端口。上面的代码就是这个bug的解决方法。我假设同样的错误存在于
HTTP 的
。如果是,那么从 http_proxy ENV 中删除perlbrew
副本中::精简版http://
将解决问题(著名的最后一句话!)更新2
只是为了让我最后的评论清楚,当你运行
perlbrew
时,你可以这样做(从像bash
这样的shell):你需要始终像这样为每个
perlbrew
命令添加前缀,至少在HTTP::Lite
或perlbrew
代理错误修复之前。上面的替代方法是,您可以只修补本地版本,只需在第 1277 行之前添加以下内容:
希望我们终于破解了它!如果一切成功,请告诉我,因为如果是这样,我将向 Gugod (
的作者)发布修复程序perlbrew
),并对HTTP::Lite
进行必要的本地更改。Based on your comments do you have
http_proxy
ENV variable set in your shell?If not then set it with your proxy settings and re-try perlbrew install:
perlbrew
uses this ENV variable to pick up the proxy server. If this ENV variable isn't set then it tries the normal direct HTTP connection (see line 1274 in perlbrew current master on Github)If that doesn't work then have a look at
HTTP::Lite
. This is whatperlbrew
uses under the hood to fetch source code. NB. perlbrew uses its own copy of HTTP::LiteFinally if still no luck you mentioned that you "first installed it" via CPAN. The docs does mention issues when upgrading from a previous CPAN version. This maybe something further you need to look into?
Update Test this
HTTP::Lite
script and let me know what you see (NB. You may need to installHTTP::Lite
):I think you've probably been hit by a known bug with
HTTP::Lite
, see RT issue uri style proxy env vars fail to set the proxy and port correctly.The above code is the workaround to this bug. I assume the same bug is in
perlbrew
copy ofHTTP::Lite
. If it is then removing thehttp://
from your http_proxy ENV would resolve the problem (famous last words!)Update 2
Just to make my last comment clear when you run
perlbrew
you can do this (from shell likebash
):You would need to always prefix every
perlbrew
command like this, at least untilHTTP::Lite
orperlbrew
proxy bug is fixed.Alternative to above is you can just patch your local version just be adding the following before line 1277:
Hopefully we've finally cracked it! Let me know if all successful because if so then I'll post a fix to Gugod (author of
perlbrew
) with necessary local changes toHTTP::Lite
.