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

发布于 2024-11-18 16:30:26 字数 5089 浏览 2 评论 0原文

我正在尝试在 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 [email protected]
    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 [email protected]
    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

I am trying to install a Perl module within Strawberry Perl on Windows 7.

I'm running the below command and am getting a slew of messages I don't understand. It looks like I am getting 500 errors, as though the page isn't reachable. However, when I point the mirrors in my browser I have no problem accessing the FTP directories. I have little Perl experience on Linux, and none on Windows. I tried manually adding a mirror to the urllist, and I don't think that helped.

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 [email protected]
    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 [email protected]
    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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

月隐月明月朦胧 2024-11-25 16:30:26

这很容易是防火墙/代理问题。您需要在cpan中设置http_proxy变量。

通过在 shell 命令提示符处键入 cpan 并按 Enter 进入 CPAN shell。进入 CPAN shell 后,输入以下内容:

o conf http_proxy http://proxy.mycorp.com:8080/

cpan 然后可能会要求您提供用户名和密码,以便您至少可以使用 HTTP 流量的代理。

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

  • 如果代理配置很简单,您可以查看浏览器。
  • 如果情况比较复杂,则必须
    • 将配置脚本的URL粘贴到浏览器地址中
    • 当浏览器提示时,使用编辑器打开该 URL(或使用采用 HTTP URL 的编辑器,例如 jEditNotepad++。)。

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

This is easily firewall/proxy issues. You need to set up the http_proxy variable in cpan.

Enter the CPAN shell by typing cpan at the shell command prompt, and hitting Enter. Once in the CPAN shell, enter the following:

o conf http_proxy http://proxy.mycorp.com:8080/

cpan may then ask you for the username and password so that you can use the proxy for HTTP traffic, at least.

It's possible that your FTP access is blocked by the firewall. cpan will work around this.

  • You can look to your browser if the proxy configuration is simple.
  • If it is more complex, you'll have to
    • paste the URL to the configuration script in the browser address
    • open that URL with an editor when the browser prompts you (or use an editor that takes HTTP URLs—like jEdit or Notepad++.).

Once you parse the case for your location and CPAN, then you can take the server name returned, add the port if any, and either set the environment variable or cpan configuration with the value.

国际总奸 2024-11-25 16:30:26

这看起来像是代理问题。 CPAN shell 使用需要设置的环境变量,以便它了解代理 - 它无法从浏览器中检测到它们。

环境变量是:

http_proxy         Proxy host for HTTP requests
ftp_proxy          Proxy host for FTP  requests

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

C:\> set http_proxy=http://proxy.sn.no:8001/
C:\> set ftp_proxy=http://proxy.sn.no:8001/
C:\> cpan

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

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

您必须弄清楚代理实际上是什么。您的浏览器应该知道,因此请查看其互联网设置。

This looks like a proxy issue. The CPAN shell uses environment variables which need to be set so it knows about a proxy -- it can't detect them from the browser.

The environment variables are:

http_proxy         Proxy host for HTTP requests
ftp_proxy          Proxy host for FTP  requests

Since you're on Windows, you can either do the following from the same command shell:

C:\> set http_proxy=http://proxy.sn.no:8001/
C:\> set ftp_proxy=http://proxy.sn.no:8001/
C:\> cpan

and then try to install as before. Since your CPAN is using FTP, the ftp_proxy will need to be set (and yes, the URL for it will typically be an HTTP one).

You can also set the environment variables permanently in the system control panel, usually under advanced settings, environment variables. You can set them either for the system or for the current user. It's best not to set them for the whole system unless you have a very good reason.

You will have to figure out what the proxy actually is. Your browser should know, so have a look in its Internet settings.

瑕疵 2024-11-25 16:30:26

我遇到了类似的问题,尽管这里的解决方案没有为我解决它。我刚刚在三台机器上将 Strawberry Perl 从 5.18.2.1 升级到 5.20.1.1,尽管 CPAN 在两台 Windows 7 机器上运行,但在 Windows Server 2003 机器上却不起作用。

最后,解决这个问题的办法是删除 CPAN 配置文件,在我的例子中是 C:\strawberry\perl\lib\CPAN\Config.pm 。我启动了 CPAN 并执行了重新加载索引;它再次询问我的凭据(我使用的代理不需要这些凭据),所以我只需按两次 Enter 键将其留空,它就成功连接并更新了其索引。

我记得以前在 Strawberry Perl 发行说明中看到过警告,要求在卸载以前的版本之后和安装新版本之前删除 C:\strawberry。这次似乎没有这样的警告,但我认为无论如何这是一个很好的做法。

顺便说一句,在设法使 CPAN 再次工作之前,我使用的临时解决方法是从我已经升级了 Perl 并且 CPAN 仍然可以工作的机器。这样,我就拥有了所需的所有模块,而无需 CPAN 实际工作。 (两台机器具有相同的架构,需要相同的安装程序进行升级。)

I had a similar issue, although the solutions here didn't fix it for me. I had just upgraded Strawberry Perl from 5.18.2.1 to 5.20.1.1 on three machines, and although CPAN worked on the two Windows 7 machines, it didn't on the Windows Server 2003 machine.

In the end, the thing that fixed it for me was to delete the CPAN configuration file, C:\strawberry\perl\lib\CPAN\Config.pm in my case. I started CPAN and did a reload index; it once again asked me for my credentials (which I don't need for the proxy I use) so I just hit enter twice to leave them blank, and it managed to connect and update its index.

I recall having previously seen warnings in the Strawberry Perl release notes to say to delete C:\strawberry after uninstalling the previous version and before installing the newer version. There doesn't seem to be such a warning this time round, but it's good practice anyway I suppose.

As an aside, a temporary workaround I used before managing to get CPAN working again was to copy across the lib, site and vendor directories from a machine on which I'd upgraded Perl already and on which CPAN did still work. This way, I had all the modules I needed without CPAN actually working. (The two machines were the same architecture, requiring the same installer to upgrade.)

獨角戲 2024-11-25 16:30:26

Strawberry Perl 环境中的 CPAN 配置文件为:

c:\Strawberry\perl\lib\CPAN\Config.pm .

特定用户的配置定义写入位于以下位置的 MyConfig.pm 文件中:C:\Users\user name\AppData\Local\ .cpan\CPAN\。可以在这些文件之一中覆盖代理定义。

The CPAN configuration file in the Strawberry Perl environment is:

c:\Strawberry\perl\lib\CPAN\Config.pm .

Configuration definitions for a specific user are written in the MyConfig.pm file located under: C:\Users\user name\AppData\Local\.cpan\CPAN\. The proxy definitions can be overridden in one of these files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文