in reply to Net::FTP via CGI mystery

Have you tried cranking up the debug level on Net::FTP? A 2 or 3 will give you a blow by blow account of the FTP session. Maybe that will give you some idea why it dies on the ls.

Also, and this may be insignificant, shouldn't
$ftp->ls be
$ftp->ls() ?
I don't know how this could make it behave differently on the command line vs. http, but that might be worth a try.