如何让App :: cpanminus工作?

时间:2010-10-17 19:49:53

标签: perl ubuntu cpan

我刚刚安装了ubuntu 10.10的新副本。我在brian d foy's recommended outline之后安装了perl 5.12.2,然后通过调用curl -L http://cpanmin.us | perl5.12.2 - --sudo App::cpanminus安装了cpanminus。

现在,cpan5.12.2工作正常,但每当我尝试使用cpanm5.12.2安装模块时,它都找不到它。 e.g:

$ sudo cpanm5.12.2 -v File::Copy::Recursive
You have make /usr/bin/make
You have LWP 5.837
You have /bin/tar: tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching File::Copy::Recursive on cpanmetadb ...
! Finding File::Copy::Recursive on cpanmetadb failed.
Searching File::Copy::Recursive on search.cpan.org ...
! Finding File::Copy::Recursive on search.cpan.org failed.
! Couldn't find module or a distribution File::Copy::Recursive

2 个答案:

答案 0 :(得分:2)

您可以尝试使用perlbrew [1]来安装自定义perl intrepreter。然后你可以激活你的5.12.2版本,安装cpanm(不需要sudo)并以普通用户的身份安装你的模块,例如。 “$ cpanm My :: Module”

通过使用此方法,您可以获得与每个特定perlbrew版本相关联的自定义cpanm二进制文件。你必须为每个perlbrew版本安装cpan模块,但你不会得到像“cpanm5.12.2”这样的二进制文件,而是“cpanm”。 Perlbrew负责设置perl-version特定的路径,这是相当方便的恕我直言。

[1] https://metacpan.org/module/App::perlbrew

答案 1 :(得分:1)

我遇到了同样的问题。 LWP在我的计算机上使用$HTTP_PROXY而不是$http_proxy

如果您在没有协议的情况下为$ http_proxy指定了一些内容(在我的情况下,我错过了http:),它会抱怨但似乎有误导性,因为它实际上并没有找到丢失的包。