Solving CPAN ftp proxy problems in perl

koschei on 2003-10-09T04:10:11

With perl 5.8 having libnet as standard and the generally appalling state of firewalls and default configurations, it can be irritating when CPAN spends 5 minutes trying Net::FTP when if it had tried, say, wget it would have been over quickly.

Quick solution:

'dontload_hash' => { 'Net::FTP' => 1 },

in your CPAN/Config.pm (or wherever you keep your config)

The docs don't elaborate on it much so I guess I'll have to submit a patch to the firewall section.

  dontload_hash      anonymous hash: modules in the keys will not be
                     loaded by the CPAN::has_inst() routine


thanks!

inkdroid on 2003-10-09T13:36:05

I've been feeling like an idiot behind my firewall for a while. Thanks for posting!

Passive FTP

triv on 2003-10-10T09:35:54

The reason why wget works for you and Net::FTP doesn't is that wget uses passive FTP. If you set the FTP_PASSIVE environment value to a true value, Net::FTP will use passive FTP.

Re:Passive FTP

koschei on 2003-10-10T10:08:46

Heh. Close. Actually, there are circumstances where FTP needs to be proxied and Net::FTP doesn't (cannot) understand a http based proxy. In this case, wget, lynx, ncftp etc. work perfectly happily. But because we haven't downloaded LWP into our fresh install we don't have something in perl that understands an http proxy. That won't stop Net::FTP from trying and eventually timing out and having the others tried.

Re:Passive FTP

aod on 2005-10-19T02:34:57

Net::FTP SUCKS BIG! export FTP_PASSIVE=1 doesnt works in debian. Do yourself a favour:

locate -i net | grep -i ftp | grep perl

them rm -r all of it and use wget!!!