$ftp->put stores empty file (Net::FTP) 
Author Message
 $ftp->put stores empty file (Net::FTP)

I have a program which runs with no errors and puts
only empty files at the destination.

I have used Net::FTP for a while and never encountered
this problem. I have checked and in all previous cases
I used get() with no problem. Apparently I never used put().

This is a reduction of what I am doing:

my $ftp = Net::FTP->new($dns_host, Timeout => 60) or
  die "Host unreachable : $dns_host : $!";
$ftp->login() or
  die "Can not login to $dns_host : " . $ftp->message;
$ftp->cwd($dns_drop_point) or
  die "Can not change directory on $dns_host : " . $ftp->message;
$ftp->ascii() or
  die "Unable to confirm ascii mode: " . $ftp->message;
$ftp->put($subnet_5) or
  die "Unable to put $subnet_5 file on $dns_host : " . $ftp->message;
$ftp->quit() or
  die "Could not close connection to $dns_host : $!";
print "DNS file created and put in place on $dns_host.\n";

and it runs to the exit without errors.

I stuck a ->get() in there above and below the ->put() and they work
fine. So the connection is being made correctly. The problem is
independent of destination systems.

I was convinced that any such bug in the Net::FTP module would have
been discussed I searched dejanews but did not find any reference
to a known bug. So I decided it was the way I was using the put
method. I tried put($subnet_5), put("$subnet_5"), put('subnet.5')
which is the file name directly put in there but none of that helped.
I also tried stor() and stou() but I confess I do not understand
why they exist.

I put a $ftp->debug(1); line just before the my $ftp = Net::FTP...
line and the output does not suggest any problem to me:

Net::FTP: Net::FTP(2.33)
Net::FTP:   Exporter
Net::FTP:   Net::Cmd(2.11)
Net::FTP:   IO::Socket::INET
Net::FTP:     IO::Socket(1.1603)
Net::FTP:       IO::Handle(1.1504)

Net::FTP=GLOB(0xb3344)>>> PORT 130,140,5,4,220,179
Net::FTP=GLOB(0xb3344)<<< 200 PORT command successful.
Net::FTP=GLOB(0xb3344)>>> STOR subnet.5
Net::FTP=GLOB(0xb3344)<<< 150 ASCII data connection for subnet.5 (,56499).
Net::FTP=GLOB(0xb3344)<<< 226 Transfer complete.
Net::FTP=GLOB(0xb3344)>>> QUIT
Net::FTP=GLOB(0xb3344)<<< 221 Goodbye.
DNS file created and put in place on abqato.

But I do note that the 150 ASCII data line does not have a file size
at the end the way the gets did when I put gets in for more debug

I ran the program with the de{*filter*} and put a break point at the
start of the above code. Stepping through it showed me no problems
but there was so much code I stepped through, which I did not
understand, that I might have missed some error.

Using a protocol analyzer on the net I can see the file is opened
and then closed without any transfer of file content.


Tue, 06 Feb 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Net::Ftp->mdtm() returns empty

2. Net::FTP $ftp->pwd() undef??

3. Net::FTP examples ftp->quit hangs

4. Net::FTP ftp->ls() stopped working

5. Net::FTP $ftp->pwd() undef??

6. Net::FTP creates Empty file

7. Net::FTP creates empty file

8. File truncate with put in NET::FTP

9. Net::FTP 'put' truncates file

10. Newbie: Net::FTP, putting more than one file at a time

11. Where does NET::FTP put downloaded file???

12. !!! Where does NET::FTP put downloaded file???


Powered by phpBB® Forum Software