如何安装模块?草莓Perl问题

Bri*_*ian 17 perl cpan module strawberry-perl

我正在尝试在Windows 7上的Strawberry Perl中安装Perl模块.

我正在运行以下命令,我收到了一些我不明白的消息.看起来我得到500个错误,好像页面无法访问.但是,当我在浏览器中指向镜像时,访问FTP目录没有问题.我在Linux上有很少的Perl经验,在Windows上没有经验.我尝试手动为urllist添加一个镜像,我觉得这没有帮助.

C:\Program Files> cpan Win32::IE::Mechanize

CPAN: LWP::UserAgent loaded ok (v5.835)
CPAN: Time::HiRes loaded ok (v1.9721)
Fetching with LWP:
http://cpan.strawberryperl.com/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:80 (Bad hostname 'cpan.strawberryperl.com')]
Warning: no success downloading 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'. Giving up on it.
Fetching with LWP:
ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz
LWP failed with code[500] message[LWP::Protocol::MyFTP: Bad hostname 'mirror.teklinks.com']
Fetching with Net::FTP:
ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz
  Could not connect to host 'mirror.teklinks.com' with Net::FTP
Fetching with Net::FTP
ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz.gz
  Could not connect to host 'mirror.teklinks.com' with Net::FTP
Warning: no success downloading 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'. Giving up on it.
Warning: no success downloading 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'. Giving up on it.

As a last resort we now switch to the external ftp command 'C:\WINDOWS\system32\ftp.EXE'
to get 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'.

Doing so often leads to problems that are hard to diagnose.

If you're the victim of such problems, please consider unsetting the
ftp config variable with

    o conf ftp ""
    o conf commit

Issuing "C:\WINDOWS\system32\ftp.EXE -n"

  Trying with external ftp to get
    ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz
  Going to send the dialog
    open mirror.teklinks.com
    user anonymous win32-vanilla@perl.org
    lcd C:\strawberry\cpan\sources\authors
    cd /
    cd CPAN
    cd authors
    bin
    passive
    get 01mailrc.txt.gz 01mailrc.txt.gz.tmp5264
    quit

Unknown host mirror.teklinks.com.
Not connected.
Local directory now C:\strawberry\cpan\sources\authors.
Not connected.
Not connected.
Not connected.
Not connected.
Invalid command.
Not connected.
Bad luck... Still failed!
Can't access URL ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz.

Fetching with LWP:
http://cpan.strawberryperl.com/authors/01mailrc.txt.gz
LWP failed with code[500] message[Can't connect to cpan.strawberryperl.com:80 (Bad hostname 'cpan.strawberryperl.com')]
Warning: no success downloading 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'. Giving up on it.
Warning: no success downloading 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'. Giving up on it.
Fetching with LWP:
ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz
LWP failed with code[500] message[LWP::Protocol::MyFTP: Bad hostname 'mirror.teklinks.com']
Fetching with Net::FTP:
ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz
  Could not connect to host 'mirror.teklinks.com' with Net::FTP
Fetching with Net::FTP
ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz.gz
  Could not connect to host 'mirror.teklinks.com' with Net::FTP
Warning: no success downloading 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'. Giving up on it.
Warning: no success downloading 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'. Giving up on it.

As a last resort we now switch to the external ftp command 'C:\WINDOWS\system32\ftp.EXE'
to get 'C:\strawberry\cpan\sources\authors\01mailrc.txt.gz.tmp5264'.

Doing so often leads to problems that are hard to diagnose.

If you're the victim of such problems, please consider unsetting the
ftp config variable with

    o conf ftp ""
    o conf commit

Issuing "C:\WINDOWS\system32\ftp.EXE -n"

  Trying with external ftp to get
    ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz
  Going to send the dialog
    open mirror.teklinks.com
    user anonymous win32-vanilla@perl.org
    lcd C:\strawberry\cpan\sources\authors
    cd /
    cd CPAN
    cd authors
    bin
    passive
    get 01mailrc.txt.gz 01mailrc.txt.gz.tmp5264
    quit

Unknown host mirror.teklinks.com.
Not connected.
Local directory now C:\strawberry\cpan\sources\authors.
Not connected.
Not connected.
Not connected.
Not connected.
Invalid command.
Not connected.
Bad luck... Still failed!
Can't access URL ftp://mirror.teklinks.com/CPAN/authors/01mailrc.txt.gz.

CPAN: YAML loaded ok (v0.73)
Please check, if the URLs I found in your configuration file
(http://cpan.strawberryperl.com/, ftp://mirror.teklinks.com/CPAN/) are
valid. The urllist can be edited. E.g. with 'o conf urllist push
ftp://myurl/'

Could not fetch authors/01mailrc.txt.gz
Run Code Online (Sandbox Code Playgroud)

Axe*_*man 19

这很容易出现防火墙/代理问题.你需要设置http_proxy变量cpan.通过cpan在shell命令提示符下键入并按Enter键进入cpan shell .一旦在cpan外壳,输入以下内容:

o conf http_proxy http://proxy.mycorp.com:8080/
Run Code Online (Sandbox Code Playgroud)

cpan 然后可能会要求您输入用户名和密码,以便至少可以使用代理进行http流量.

您的ftp访问可能被防火墙阻止.cpan将解决这个问题.

  • 如果代理配置很简单,您可以查看浏览器.
  • 如果它更复杂,你必须这样做
    • 将URL粘贴到浏览器地址中的配置脚本
    • 当浏览器提示您时,使用编辑器打开该URL(或使用带有http URL的编辑器,如jEditNotepad ++).

解析了您的位置和CPAN的大小写后,您可以获取返回的服务器名称,端口(如果有),并http_proxy使用该值设置环境变量或配置.

  • 运行`o conf init/proxy /`来查看/设置所有与代理相关的选项,而不仅仅是常用的HTTP代理. (2认同)

Stu*_*att 7

这看起来像代理问题.该ftp_proxy外壳采用这就需要进行设置,以便它知道一个代理环境变量-它无法从浏览器检测到它们.

环境变量是:

http_proxy         Proxy host for HTTP requests
ftp_proxy          Proxy host for FTP  requests
Run Code Online (Sandbox Code Playgroud)

由于您使用的是Windows,因此可以从同一命令shell执行以下操作:

C:\> set http_proxy=http://proxy.sn.no:8001/
C:\> set ftp_proxy=http://proxy.sn.no:8001/
C:\> cpan
Run Code Online (Sandbox Code Playgroud)

然后尝试像以前一样安装.由于您的CPAN使用FTP,因此ftp_proxy需要设置(并且是的,它的URL通常是HTTP).

您还可以在系统控制面板中永久设置环境变量,通常在高级设置环境变量下.您可以为系统或当前用户设置它们.除非你有充分的理由,否则最好不要为整个系统设置它们.

您将不得不弄清楚代理实际上是什么.您的浏览器应该知道,所以看看它的互联网设置.