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

How do I stop CPAN from accessing an unresponsive package repository?

我试图安装一个包。无法连接到 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...
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:删除错误的存储库

运行 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.

询问 "Would you like to edit the urllist or pick new mirrors from a list?" 时,按 Enter。

当询问 [​​=56=] 时,输入 no

Select 按照提示进行镜像。

最后,按如下方式保存您的更改:

o conf commit