I'm getting a "Bad file descriptor" error when I try and list the files on my FTP server.
Server is *nix, trying to connect on my WinXP box
I can connect and login just won't list any files.
Tried 'ls' as well as 'dir' with same result.
my $host="FTP.server.net";
my $directory="/";
$ftp=Net::FTP->new($host,Debug=> 1,Passive=> 1,Timeout=>240) or $newerr=1;
push @ERRORS, "Can't ftp to $host: $!\n" if $newerr;
myerr() if $newerr;
print "Connected\n";
$ftp->login("user","pass") or $newerr=1;
print "Getting file list";
push @ERRORS, "Can't login to $host: $!\n" if $newerr;
$ftp->quit if $newerr;
myerr() if $newerr;
print "Logged in\n";
$ftp->cwd($directory) or $newerr=1;
push @ERRORS, "Can't cd $!\n" if $newerr;
myerr() if $newerr;
$ftp->quit if $newerr;
@files=$ftp->dir or $newerr=1;
push @ERRORS, "Can't get file list $!\n" if $newerr;
myerr() if $newerr;
print "Got file list\n";
foreach(@files) {
print "$_\n";
}
$ftp->quit;
sub myerr {
print "Error: \n";
print @ERRORS;
exit 0;
}