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

Hi, I am getting Can't locate object method "new" via package "Net::FTP::A" at /usr/perl5/5.00503 /sun4-solaris/IO/Socket.pm line 253. error when I try to put a file on the FTP server. This is a new install of Net::FTP and since I am behind the corp firewall I had to install the Net::FTP, Cmd.pm and Config.pm by downloading and cp the files to the local perl_lib folder. Here is the Debug trace and the code. I saw plenty of posting on the net with this problem, but no solutions. Thanks.

Debug Trace

-> perl -w ftp_files.pl Net::FTP>>> Net::FTP(2.71) Net::FTP>>> Exporter Net::FTP>>> Net::Cmd(2.24) Net::FTP>>> IO::Socket::INET Net::FTP>>> IO::Socket(1.1603) Net::FTP>>> IO::Handle(1.1505) Net::FTP=GLOB(0x5dde8)<<< 220 Microsoft FTP Service (Version 5.0). Net::FTP=GLOB(0x5dde8)>>> user test Net::FTP=GLOB(0x5dde8)<<< 331 Password required for test. Net::FTP=GLOB(0x5dde8)>>> PASS .... Net::FTP=GLOB(0x5dde8)<<< 230 user test logged in. Net::FTP=GLOB(0x5dde8)>>> CWD test Net::FTP=GLOB(0x5dde8)<<< 250 CWD command successful. Net::FTP=GLOB(0x5dde8)>>> ALLO 35 Net::FTP=GLOB(0x5dde8)<<< 200 ALLO command successful. Net::FTP=GLOB(0x5dde8)>>> PORT 10,208,8,134,156,192 Net::FTP=GLOB(0x5dde8)<<< 200 PORT command successful. Net::FTP=GLOB(0x5dde8)>>> STOR ndm_rpt_133.csv Net::FTP=GLOB(0x5dde8)<<< 150 Opening ASCII mode data connection for n +dm_rpt_133.csv. Can't locate object method "new" via package "Net::FTP::A" at /usr/per +l5/5.00503 /sun4-solaris/IO/Socket.pm line 253.

Code

use lib '/opt/autotree/autouser/perl_lib'; # Location of Net::FTP use strict; use Net::FTP; my $ftp = Net::FTP->new($ftp_server, Timeout => 30, Debug => 1) or die "Error: Cannot connect to FTP server $ftp_server $@\n"; $ftp->login($ftpid, $ftppwd) or die "Error: FTP Login Failed $@\n"; $ftp->cwd($ftp_file_dir) or die "Error: Unable to change to directory $ftp_file_dir $@\n"; $ftp->put($file) or die "Error: Cannot $ftp_cmd file $ftp_file $@\n"; $ftp->quit() or warn "Could not quit ftp session gracefully\n"; </p>

Replies are listed 'Best First'.
Re: Net::FTP Error
by iburrell (Chaplain) on Dec 19, 2003 at 01:24 UTC
    Did you install the Net/FTP/A.pm file? There should be five files in the Net/FTP directory of the perl lib directory where you put Net/FTP.pm. If you didn't install them, then Net::FTP won't work.
      While you're at it, you might want to take a look at A Guide to Installing Modules. If you for some reason you can't put the modules in the standard location, check out the "I don't have permission to install a module on the system!" section, it's much better than copying by hand.
Re: Net::FTP Error
by cutter (Acolyte) on Dec 19, 2003 at 15:42 UTC
    The Net::FTP::A mod was missing. I rummaged some more on CPAN and found the mod libnet-1.17 that installs all of the needed Net modules. Thanks Monks!!