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 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
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:
Since you're on Windows, you can either do the following from the same command shell:
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.
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 areload 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
andvendor
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.)This is easily firewall/proxy issues. You need to set up
http_proxy
variable incpan
. Enter the cpan shell by typingcpan
at the shell command prompt, and hitting enter. Once in thecpan
shell, enter the following: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.Once you parse the case for your location and CPAN, then you can take the server name returned, a the port if any, and either set the environment variable or
cpan
configuration with the value.The CPAN configuration file in the Strawberry Perl environment is:
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.