in reply to Re: FTP downloading failed
in thread FTP downloading failed

Thank you for reminding me for that. here are my code, very straight forward:
my $ftp = Net::FTP->new($input->{remote_ip}, Debug => 0, Timeout => 8) +; $ftp->login($input->{remote_login}, $input->{remote_password}) or push + (@$error_minilog, "Cannot login to repository: Invalid login or pass +word"); $ftp->type('I'); $ftp->cwd($input->{remote_path}) or push (@$error_minilog, "Cannot cha +nge repository path"); my $ftpret = $ftp->get("filename", "localfilename") or push (@$error_m +inilog, "Failed to download file");
I try to print the $ftpret, it was null.

Replies are listed 'Best First'.
Re: Re: Re: FTP downloading failed
by bobn (Chaplain) on Jun 25, 2003 at 06:38 UTC
    Well, it looks like even if any of new() login() type() cwd() methods fail, you will continue with the process (having diligently saved messages to @$error_minilog). So you should a) stop if any of the prerequsites fail and b) print out @$error_minilog to see what happened.

    However, since you get part of the file, the pre-reqs are probably working (though if cwd() failed you may not be getting the file you think you're getting). The doc says a null return means the operation failed, which confirms the get() fails.

    Several possibilities suggest themselves to me:
    1. There is a network flakiness between you and the ftp server, which you might test manually using an ftp client or,
    2. whatever the reason for the problem, you have a better chance of seeing it with Debug => 1 or some other positive value in new(). or
    3. cwd() failed and a shorter file of the same name exists in the directory you are left in.


    --Bob Niederman, http://bob-n.com
      Be sure that type('I') is correct and succeeded. I seem to rememeber that trying to retrieve binary files in ascii mode will frequently hang.

      --Bob Niederman, http://bob-n.com