CPAN is an essential tool for Perl developers. With the “cpan” command, you can install whole Perl libraries effortlessly. However, on many default installations of cygwin, cpan simply hangs:
cpan> install LWP
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Sat, 26 Feb 2005 19:48:34 GMT
LWP not available
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
ftp://ftp.sonic.net/mirrors/CPAN/au…01mailrc.txt.gz
As it turns out, Net::FTP defaults to non-passive FTP, which conflicts with many firewalls since it requires a connection from the FTP server back to the FTP client.
How can you fix this? Set the FTP_PASSIVE environment variable to 1:
BASH> export FTP_PASSIVE=1
DOS> set FTP_PASSIVE=1
This allows cpan to successfully retrieve files.
If you are creating a Net::FTP object in Perl, you can use:
$ftp=Net::FTP->new(HOST,[your options,]Passive => ‘1’)
This will force the FTP connection to be passive and work through firewalls.
GReat blog keep it up