tgeliot has asked for the wisdom of the Perl Monks concerning the following question:
(host and username changed, obviously)$ cat testDelete.pl #!/usr/bin/perl use strict; use warnings; use Net::FTP; use shipments; use constant FALSE =>0; use constant TRUE =>1; my $DEBUG = TRUE; ###################################################################### +# # returns TRUE if successful sub ftpDeleteRemoteFile($$$$) { my ($host, $user, $password, $remoteFile) = @_; my $ftp = Net::FTP->new($host, Debug => $DEBUG); if (! $ftp) { print "Cannot make FTP connection to $host: $@\n"; return FALSE; } if (! $ftp->login($user, $password)) { print "Cannot log in via FTP connection as $user to $host: " +. $ftp->message . "\n"; $ftp->quit; return FALSE; } if (! ftp->delete($remoteFile) ) { print "Cannot delete file $remoteFile from host $host\n"; $ftp->quit; return FALSE; } $ftp->quit; return TRUE; } ftpDeleteRemoteFile(getShipperHost(), getShipperUser(), getShipperPass +word(), "to/csgload/testfile1"); # Keep the perl compiler happy TRUE; The output I get is: $ testDelete.pl Net::FTP>>> Net::FTP(2.77) Net::FTP>>> Exporter(5.58) Net::FTP>>> Net::Cmd(2.29) Net::FTP>>> IO::Socket::INET(1.29) Net::FTP>>> IO::Socket(1.29) Net::FTP>>> IO::Handle(1.25) Net::FTP=GLOB(0xfdd3e0)<<< 220 Welcome to XXX FTP service. Net::FTP=GLOB(0xfdd3e0)>>> USER YYY Net::FTP=GLOB(0xfdd3e0)<<< 331 Please specify the password. Net::FTP=GLOB(0xfdd3e0)>>> PASS .... Net::FTP=GLOB(0xfdd3e0)<<< 230 Login successful. Can't locate object method "delete" via package "ftp" (perhaps you for +got to load "ftp"?) at /home/stats/csgload/bin/perl/testDelete.pl lin +e 32.
I have perl 5.8.8, and version 2.77 of Net::FTP
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: In Net::FTP, "Can't locate object method "delete" via package ftp..."
by thezip (Vicar) on Jul 11, 2008 at 21:21 UTC | |
by tgeliot (Initiate) on Jul 14, 2008 at 15:35 UTC | |
|
Re: In Net::FTP, "Can't locate object method "delete" via package ftp..."
by tilly (Archbishop) on Jul 11, 2008 at 21:26 UTC |