我正在Windows 7上安装草莓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
解决方法
这很容易发生防火墙/代理问题。您需要在cpan中设置http_proxy变量。
在shell命令提示符下输入cpan,然后按Enter键进入cpan shell。在cpan shell中,输入以下内容:
在shell命令提示符下输入cpan,然后按Enter键进入cpan shell。在cpan shell中,输入以下内容:
o conf http_proxy http://proxy.mycorp.com:8080/
cpan可能会要求您输入用户名和密码,以便至少可以使用该代理进行http流量。
您的ftp访问可能被防火墙阻止。 cpan会解决这个问题。
>如果代理配置很简单,可以查看浏览器。
>如果它更复杂,你必须
>将URL粘贴到浏览器地址中的配置脚本中
>当浏览器提示您(或使用需要http URL的编辑器,如jEdit或Notepad++)时,使用编辑器打开该URL。
一旦您解析了您的位置和CPAN的情况,您可以获取返回的服务器名称,一个端口(如果有的话),并且使用该值设置环境变量或cpan配置。