Consider the various problems of File Transfer Protocol (FTP), and whether a Hyper Text Transfer Protocol (HTTP) mirror would make more sense.
More information about the Comprehensive Perl Archive Network (CPAN).
Active FTP versus Firewalls
Network problems may prevent access to CPAN mirror sites. The chief problem will be utilities set to use active FTP, which most firewalls block. Peruse Active FTP vs. Passive FTP, a Definitive Explanation for more details. I recommend enabling passive FTP by default, though this setting will need to be done for a variety of utilities CPAN might run, such as wget or Net::FTP. Alternatives include disabling the client firewall to allow active FTP connections back from the FTP server, or configuring a local FTP proxy, or instead using a HTTP mirror.
Set the FTP_PASSIVE environment variable before running cpan.
# env FTP_PASSIVE=1 cpan -i Net::FTP
During the install of the libnet distribution, enable passive FTP.
…
Ah, I see you already have installed libnet before.
Do you want to modify/update your configuration (y|n) ? [no] y
…
Should all FTP connections be passive (y|n) ? [no] y
If Net::FTP is already installed, edit the libnet.cfg configuration file to use passive FTP.
$ perl -le 'for (@INC) { $_ .= "/".$ARGV[0]; print if -f }' Net/libnet.cfg
/usr/local/lib/perl5/5.8.1/Net/libnet.cfg
$ grep passive /usr/local/lib/perl5/5.8.1/Net/libnet.cfg
'ftp_int_passive' => 1,
If Net::FTP does not work, or certain utilities take too long to time out, consider the following options.
- Disable Net::FTP.
- Disable utilities that do not work
If Net::FTP does not work, try adding the following line to the CPAN/Config.pm preferences file. More information on dontload_hash posted to the perl.perl5.porters newsgroup. Also consider installing LWP::UserAgent, which is more capable than Net::FTP.
'dontload_hash' => { 'Net::FTP' => 1 },
To reconfigure CPAN to not call certain utilities, replace the path to the utility with a single space.
$ grep ncftp ~/.cpan/CPAN/MyConfig.pm
'ncftp' => q[ ],
'ncftpget' => q[ ],