NET::FTP ls error

B

Bob

running on w2k pro sp2 system. Code is:

# ftptst.plx - 10 July 2003. testing ftp script
use warnings;
use strict;
use Net::FTP;
my ($hostname, $username, $password, $directory, $filename, $ftpobj, @last);
#declaration of parameters
$hostname="ftp.nowhere.com";
$username="anonymous";
$password="tst\@tsthere";
$directory="/pub";
$filename="*.txt";

$ftpobj = Net::FTP -> new ($hostname);
$ftpobj -> login($username, $password);
$ftpobj -> cwd ($directory);
@last = ftp->ls($filename) or die "No $filename found.\n";
$ftpobj -> quit;
-------------------- end of code ---------------------------
The above code works - the error is with the line requesting ls
@last = ftp->ls($filename) or die "No $filename found.\n";

the error reported is:
D:\perl\srccode\ftp>perl ftptst.plx
Can't locate object method "ls" via package "ftp" (perhaps you forgot to
load "ftp"?) at ftptst.plx line 25.

Questions:
1. Doesnt the line -- use NET::FTP -- load "ftp" ???
2. Is there a source for examples of using net::ftp?

thanks
r
 
B

Bob

Hi Michael -

thanks.

another question.. to avoid these really "bad" mistakes, is there some
kind of checker program that checks the code for content or properly defined
statement, etc...
 
M

Michael Budash

[top-posting fixed just this once]

Bob said:
thanks.

another question.. to avoid these really "bad" mistakes, is there some
kind of checker program that checks the code for content or properly defined
statement, etc.

the error you got is as good as you can get!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Staff online

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top