CPAN首次启动(代理配置) [英] CPAN first launch (Proxy Configuration)

查看:210
本文介绍了CPAN首次启动(代理配置)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要运行cpan槽代理,但是当我尝试配置时出现错误,无法第一次输入cpan

i need to run cpan trough proxy but when i try to configure i got errors and cant enter to cpan for the first time

root@srv-linux01:~# cpan

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] no

在代理设置上:

If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.

 <ftp_proxy>
Your ftp_proxy? [] http://username:password@proxyIP:Port/  <---- is ok the information?

 <http_proxy>
Your http_proxy? [] http://username:password@proxyIP:Port/  <---- is ok the information?

 <no_proxy>
Your no_proxy? []



If your proxy is an authenticating proxy, you can store your username
permanently. If you do not want that, just press ENTER. You will then
be asked for your username in every future session.

Your proxy user id? []     <---- username is needed again?


Your password for the authenticating proxy can also be stored
permanently on disk. If this violates your security policy, just press
ENTER. You will then be asked for the password in every future
session.

Your proxy password?     

在此之前,我得到了这个。

And before that i get this.

Fetching with HTTP::Tiny:
http://www.perl.org/CPAN/MIRRORED.BY.gz
Error downloading with HTTP::Tiny: Not a CODE reference at /usr/share/perl/5.18/CPAN/HTTP/Client.pm line 112, <STDIN> line 65.

Im使用Ubuntu Server 14.04 LTS和Perl 5.18.2

Im using Ubuntu Server 14.04 LTS and Perl 5.18.2

谢谢

推荐答案

是的,这很令人生气。

此SO答案表明,也许安装LWP(及其18个依赖项)会使问题变得更好。天哪,很高兴我不必求助于此。

This SO answer suggests that maybe installing LWP (and its 18 dependencies) makes the problem better. Gosh, I'm glad I didn't have to resort to that.

我遇到的问题是我已经有 http_proxy https_proxy 以及在我的环境中设置(导出)的 both 的大写版本。当这些环境变量存在时,几乎所有其他程序(包括 wget curl )都可以正常工作。不得不再次设置它们,然后仍然使CPAN失败,显然是呼吁 wget

The issue I had with this was that I already had http_proxy, https_proxy, and the uppercase versions of both of those set (and exported) in my environment. Just about every other program (including wget and curl) is works fine when these environment variables are present. It made no sense to have to set these again, and then still have CPAN fail, when it's obviously calling out to wget!

最终对我有用的是按照此处,将CPAN http_proxy 配置设置设置为空字符串。 (我以前也通过手动编辑〜/ .cpan / CPAN / MyConfig.pm 删除了代理用户名和密码设置。)

What did finally work for me was to follow the instructions here, setting the CPAN http_proxy config setting to the empty string. (I also had previously removed the proxy username and password settings by hand-editing ~/.cpan/CPAN/MyConfig.pm.)

$ cpan  # or perl -MCPAN -e shell
cpan[1]> o conf http_proxy ""
cpan[2]> o conf ftp_proxy ""
cpan[3]> o conf proxy_user ""
cpan[4]> o conf proxy_pass ""
cpan[5]> o conf commit
cpan[6]> q

$ # I have a shell function that does basically this
$ export http_proxy="http://user:pass@proxyserver:8080"
$ for v in HTTP_PROXY https_proxy HTTPS_PROXY ftp_proxy FTP_PROXY; do
> export $v="$http_proxy"
> done

$ cpan i Devel::Repl   # or whatever

然后,据推测, wget 只是在调用 cpan 之前使用定义的环境变量,这当然可以正常工作。如果您有需要身份验证的代理,则Arch Wiki上的本文有一个小脚本,它会提示您输入凭据,然后设置所有适当的 * _ proxy * _ PROXY 环境变量。

Then, presumably, wget was just using the environment variables defined before calling cpan, which of course works fine. If you have a proxy that requires authentication, this article on the Arch wiki has a little script that will prompt you for the credentials, and then set all the appropriate *_proxy and *_PROXY environment variables.

请注意,就像公共服务公告一样,请不要在明文配置文件或〜/ .bashrc 。

这篇关于CPAN首次启动(代理配置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆