[Melbourne-pm] Strange behaviour from Net::TFTP

Leigh Sharpe lsharpe at pacificwireless.com.au
Thu Oct 16 18:30:05 PDT 2008


Hi guys,
 I'm seeing what I consider to be odd behaviour using Net::TFTP to copy
some files to a remote machine. The part of the code giving me problems
is this:
 
use strict;
use warnings;
use Net::TFTP;
 
my $ip="1.2.3.4";                                # Insert IP address of
your TFTP server here.   
my $tftp=Net::TFTP->new($ip);     
$tftp->put("file1", "file1") or print "Problem saving file1:
".$tftp->error()."\n";
$tftp->put("file2", "file2") or print "Problem saving file2:
".$tftp->error()."\n";
$tftp->put("file3", "file3") or print "Problem saving file3:
".$tftp->error()."\n";
$tftp->put("file4", "file4") or print "Problem saving file4:
".$tftp->error()."\n";

If all 4 files exist, all is OK. However, if file3 does not exist, I get
the following:
 
>perl tftp_test.pl
Problem saving file3: file3: No such file or directory
Problem saving file4: file3: No such file or directory
 
 
Now, I can understand that the error message reported by $tftp->error()
contains the last error encountered, ie that file3 doesn't exist, but
there is no reason why copying file4 should fail, because it does exist.
Worse still, file4 is created on the TFTP server, but is empty. So the
non-existence of file3 is causing the copy of file4 to fail.
Anyody care to comment on why?
Should I be calling some other method in between put()'s?
I considered just DESTROYing the object after each put(), and creating a
new one, but that just seems wrong.
I could of course test for the existence of each file first, but the
docs for Net::TFTP indicate that the above should work, and I'd like to
know what I'm missing.
 
Regards,
             Leigh
 
Leigh Sharpe
Network Systems Engineer
Pacific Wireless
Ph +61 3 9584 8966
Mob 0408 009 502
Helpdesk 1300 300 616
email lsharpe at pacificwireless.com.au
<blocked::mailto:lsharpe at pacificwireless.com.au> 
web www.pacificwireless.com.au
<blocked::http://www.pacificwireless.com.au/> 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20081017/e5d76459/attachment.html>


More information about the Melbourne-pm mailing list