LWP failed with code[400]

When installing Perl modules with cpan, it is possible to get a error due to the firewall.


Fetching with LWP:
ftp://cpan.cs.utah.edu/CPAN/authors/01mailrc.txt.gz
LWP failed with code[400] message[FTP return code 150]
Fetching with Net::FTP:
ftp://cpan.cs.utah.edu/CPAN/authors/01mailrc.txt.gz

after doing:

perl -MCPAN -e shell
install

It typically hangs for a while while trying to fetch for a while over LWP or FTP
The simple fix is: export FTP_PASSIVE=1 before calling sudo perl -MCPAN -e shell or sudo cpan as the case may be.

The same thing ca be done within cpan with o conf ftp_passive

Leave a Reply