我如何告诉CPAN.pm在哪里获取模块?

时间:2008-12-08 21:15:12

标签: perl yaml cpan

以下是CPAN的完整安装命令和输出:

sudo perl -MCPAN -e "install Bundle::CPAN"
CPAN: Storable loaded ok (v2.13)
Going to read /home/delgreco/.cpan/Metadata
  Database was generated on Mon, 08 Dec 2008 03:27:10 GMT
CPAN: LWP::UserAgent loaded ok (v2.033)
CPAN: Time::HiRes loaded ok (v1.55)
CPAN: YAML loaded ok (v0.39)
Warning: YAML version '0.39' is too low, please upgrade!
I'll continue but problems are *very* likely to happen.
Your urllist is empty! The urllist can be edited. E.g. with 'o conf urllist
push ftp://myurl/'

Could not fetch authors/id/A/AN/ANDK/Bundle-CPAN-1.857.tar.gz
Giving up on '/home/delgreco/.cpan/sources/authors/id/A/AN/ANDK/Bundle-CPAN-1.857.tar.gz'
Note: Current database in memory was generated on Mon, 08 Dec 2008 03:27:10 GMT

        ...propagated at /usr/lib/perl5/5.8.5/CPAN.pm line 3417.

这对我有用,谢谢......

  

CPAN> o conf urllist   http://cpan.yahoo.com/

当然,Bundle :: CPAN安装在其他依赖项上失败了,但至少我现在有一个YAML 0.68。

3 个答案:

答案 0 :(得分:19)

这看起来很重要:

Your urllist is empty! The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/'

也许运行sudo cpan,然后o conf inito conf urllist push http://cpan.yahoo.com/(例如)让你的urllist理顺?然后尝试进行安装。

答案 1 :(得分:4)

当您第一次使用CPAN模块时,您会被问到“您准备好继续进行交互式配置吗?”你可能回答“不”。选择了默认配置选项,因此没有为您配置CPAN存储库镜像以从中提取模块tarball。

正如其他人所说,您可以使用CPAN shell中的o conf urllist命令配置该选项。

我个人的偏好是创建一个“miniCPAN”,一个基本上包含每个模块的最新版本的本地存储库(远小于拉动所有CPAN,其中包含每个模块的许多过时版本)。为此,请将CPAN镜像存储库配置为临时使用,从中安装CPAN :: Mini模块,然后使用将安装的minicpan命令行程序来创建存储库。现在使用o conf urllist pop来删除你配置的CPAN镜像,并且配置文件:/// path / to / your / minicpan告诉CPAN模块从现在开始从本地镜像安装。你可以将minicpan命令放在cron中定期更新,或者只要你想刷新就从命令行运行它。

minicpan命令的格式为

minicpan -l /path/to/your/local/minicpan-repository -r http://example.com/url/of/CPAN/mirror

答案 2 :(得分:0)

猜测:

sudo perl -MCPAN -e "install YAML"