scott09 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to make a FTP connection via my perl script and am using the standard: - $ftp=Net::FTP->new("$hostname") - script to create the object. The problem is that I keep getting the error: "can't locate object method "new" via package "Net::FTP". I think the 'use' reference is correct and so am wondering if any of you have seen this before and know what I can do to fix it. Thanks in advance, Scott

Replies are listed 'Best First'.
Re: Keep getting error using Net::FTP mod
by tadman (Prior) on Jul 11, 2001 at 02:34 UTC
    Usually you get this error if you forget to 'use' the module, or your module installation is corrupted, and Net/FTP.pm might actually be an empty file or somesuch. For example, running just that line of code without the use line gives me the error. However, this code works:
    use Net::FTP; $ftp=Net::FTP->new("$hostname");
    Maybe you could post some more code, especially the 'use' line that you're, well, using.
Re: Keep getting error using Net::FTP mod
by princepawn (Parson) on Jul 11, 2001 at 11:13 UTC
    Net::FTP is obtained via the libnet distribution. What happens at your shell prompt when you type:
    perl -MNet::FTP
      I had just installed Net::FTP. Once I installed the libnet module the problem disappeared.