How do I install a module? Strawberry Perl issues

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.)


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.


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.