如何阻止CPAN访问无响应的软件包存储库?

时间:2016-12-24 21:29:48

标签: perl cpan

我试图安装一个包。它未能连接到soft-download.org。我不知道它为什么要连接到那台主机。

$ cpan install Config::IniFiles
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: Storable loaded ok (v2.53_01)
Reading '/home/Chloe/.cpan/Metadata'
  Database was generated on Sat, 24 Dec 2016 20:17:02 GMT
Running install for module 'Config::IniFiles'
CPAN: LWP::UserAgent loaded ok (v6.15)
CPAN: Time::HiRes loaded ok (v1.9732)
Fetching with LWP:
http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
LWP failed with code[500] message[Can't connect to soft-download.org:80]

Trying with
    /usr/bin/wget -O "/home/Chloe/.cpan/sources/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz.tmp11320"
to get
    http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
--2016-12-24 16:19:24--  http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
Resolving soft-download.org (soft-download.org)... 204.45.81.83
Connecting to soft-download.org (soft-download.org)|204.45.81.83|:80... failed: Connection timed out.
Retrying.

--2016-12-24 16:19:46--  (try: 2)  http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
Connecting to soft-download.org (soft-download.org)|204.45.81.83|:80... failed: Connection timed out.
Retrying.

--2016-12-24 16:20:09--  (try: 3)  http://soft-download.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-2.94.tar.gz
Connecting to soft-download.org (soft-download.org)|204.45.81.83|:80... failed: Connection timed out.
Retrying.

我尝试重新加载索引,但仍尝试访问soft-download.org

cpan[2]> reload index
CPAN: Storable loaded ok (v2.53_01)
Reading '/home/Chloe/.cpan/Metadata'
  Database was generated on Sat, 24 Dec 2016 20:17:02 GMT
CPAN: LWP::UserAgent loaded ok (v6.15)
CPAN: Time::HiRes loaded ok (v1.9732)
Fetching with LWP:
http://soft-download.org/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to soft-download.org:80]

Trying with
    /usr/bin/wget -O "/home/Chloe/.cpan/sources/authors/01mailrc.txt.gz.tmp14304"
to get
    http://soft-download.org/authors/01mailrc.txt.gz
--2016-12-24 16:27:15--  http://soft-download.org/authors/01mailrc.txt.gz
Resolving soft-download.org (soft-download.org)... 204.45.81.83
Connecting to soft-download.org (soft-download.org)|204.45.81.83|:80...

2 个答案:

答案 0 :(得分:9)

cpan[5]> o conf urllist
    urllist
        0 [http://soft-download.org/]
        1 [http://cpan.develooper.com/]
        2 [http://cpan.erlbaum.net/]

cpan[10]> o conf urllist http://cpan.erlbaum.net http://cpan.develooper.com
Please use 'o conf commit' to make the config permanent!


cpan[11]> o conf urllist
    urllist
        0 [http://cpan.erlbaum.net]
        1 [http://cpan.develooper.com]
Type 'o conf' to view all configuration items


cpan[12]> o conf commit
commit: wrote '/home/Chloe/.cpan/CPAN/MyConfig.pm'

http://www.cpan.org/SITES.html

答案 1 :(得分:4)

解决方案1:删除坏存储库

不带参数运行cpan,然后输入

o conf urllist

这将列出要使用的存储库。

urllist
    0 [http://good1/]
    1 [http://good2/]
    2 [http://bad/]

重新输入没有错误的存储库,如下所示:

o conf urllist http://good1/ http://good2/

最后,保存更改,如下所示:

o conf commit

解决方案2:找到最适合您的存储库

不带参数运行cpan,然后输入

o conf init urllist

当被问到“你想让我自动选择一些CPAN镜子吗? 网站给你?“,按Enter键。

最后,保存更改,如下所示:

o conf commit

解决方案3:按地区查找存储库

不带参数运行cpan,然后输入

o conf init urllist

当被问到“你想让我自动选择一些CPAN镜子吗? 您的网站?“,请输入no

当系统询问“你想编辑urllist还是从列表中选择新镜像?”时,按Enter键。

当询问“我应该使用缓存的镜像列表吗?”时,请输入no

按照提示的指示选择镜像。

最后,保存更改,如下所示:

o conf commit