Re: Net::FTP Wierdness; or Not.....
- From: huntingseasonson@xxxxxxxxx
- Date: 10 Nov 2006 16:37:56 -0800
On Nov 9, 7:10 pm, Ben Morrow <benmor...@xxxxxxxxxxxxx> wrote:
Quoth huntingseason...@xxxxxxxxx:
Doing batches of FTP transfers.It is considered polite here to write in complete sentences.
Most of the time they work, sometimes
they dont. When they dont, the error messages seem to be the response
from the FTP server acknowledging my previous command, or empty.
Heres the code:Do you know what this does? If not, don't put it there.
sub ftp_transfer() ^^
sure, type checking arguments, in this case, we accept none
{globals: that's considered very bad style, for a number of good reasons.
my $ftp = Net::FTP->new($host) || _error("Can't connect to host $host:
$@");What is $host? I hope you're not passing values into subroutines through
indeed
_netcmd_error($ftp,"Can't login to $host as $username: "
$ftp->message)This line is not valid Perl. Are you missing a .?
unless $ftp->login($username,$password);This would be much clearer written as
$ftp->login($username, $password)
or _netcmd_error $ftp,
"Can't login to $host as $username: " . $ftp->message;
#ERROR COMES FROM HERE
_netcmd_error($ftp,"Can't transfer file $video: " . $ftp->message)
unless $ftp->put($video);
#################################################
$ftp->quit;
return 1;
}
The error I get is either: "Opening BINARY mode data connection for
xyz.mpg"
or empty.
Humm, I guess its probably better to call binary() 1st. But I cant
understand why the 2nd put() call fails with either nothing in
message(), or the response from the server when I called binary(). The
perldocs say that all calls return a true or false to indicate success
or failure, unless otherwise noted. So it is failing, but the message
is faulty. I really dont know.
From a quick look at the source of Net::FTP, I would say that if the put
fails sometime during the transfer (that is, if the STOR FTP command
succeeds but the actual transfer fails) then $ftp->message will not
contain anything useful. Try your transfer passing the Debug => 1 option
to Net::FTP to see if you can work out what's going wrong.
Ben
I will try debug
.
- References:
- Net::FTP Wierdness; or Not.....
- From: huntingseasonson
- Re: Net::FTP Wierdness; or Not.....
- From: Ben Morrow
- Net::FTP Wierdness; or Not.....
- Prev by Date: Re: Creating string "user@host" elegantly
- Next by Date: Re: Creating string "user@host" elegantly
- Previous by thread: Re: Net::FTP Wierdness; or Not.....
- Next by thread: guaranteeing interrupt handling
- Index(es):
Relevant Pages
|