2017-03-07 56 views
3

我需要運行CPAN低谷代理,但是當我嘗試配置我得到的錯誤和無法進入到CPAN首次CPAN首次發射(代理服務器配置)

[email protected]:~# 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:[email protected]:Port/ <---- is ok the information? 

<http_proxy> 
Your http_proxy? [] http://username:[email protected]: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?  

在此之前,我明白了這一點。

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. 

使用Ubuntu服務器14.04 LTS和Perl 5.18.2

感謝

+0

......你是否試過將代理配置指定爲URL,並分別給予用戶/密碼? – Sobrique

+0

贊 您的ftp_proxy? [] http:// ipaddress:port/ 您的http_proxy? [] http:// ipaddress:port/ 和用戶和通過之前?是的,我得到相同的... –

+0

你不能像這樣使用CPAN安裝:'export http_proxy = http://httpproxy.test.com:8080 /;導出https_proxy = $ http_proxy' – AbhiNickz

回答

1

啊,這是相當惱人的進出口。

This SO answer暗示可能安裝LWP(及其18個依賴項)會使問題更好。天哪,我很高興我不必訴諸於此。

我不得不這樣做的問題是,我已經有http_proxyhttps_proxy,和在我的環境的設置(和出口)的大寫版本。幾乎所有其他程序(包括wgetcurl)在出現這些環境變量時都能正常工作。這是沒有意義的必須重新設置這些,然後仍然有CPAN失敗,當它明顯呼叫到wget

什麼終於爲我工作是按照指示here,設置CPAN http_proxy配置設置爲空字符串。

$ 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:[email protected]: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,這當然正常工作之前定義的環境變量(我也有以前刪除手工編輯~/.cpan/CPAN/MyConfig.pm代理用戶名和密碼設置)。如果您的代理需要身份驗證,Arch維基上的this article有一小段腳本會提示您輸入憑據,然後設置所有相應的*_proxy*_PROXY環境變量。

在該說明中,就像公共服務公告一樣,請不要將重要的密碼放在純文本配置文件或您的~/.bashrc中。