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

Leigh Sharpe lsharpe at pacificwireless.com.au
Thu Oct 16 19:24:06 PDT 2008


Thanks Toby,
 It does sound similar, but as far as I can tell, Net::TFTP isn't going
to be calling any Net::FTP functions, so I don't think the patch there
is going to help me any.

 

-----Original Message-----
From: Toby Corkindale [mailto:toby.corkindale at strategicdata.com.au] 
Sent: Friday, 17 October 2008 10:59 AM
To: Leigh Sharpe
Cc: melbourne-pm at pm.org
Subject: Re: [Melbourne-pm] Strange behaviour from Net::TFTP

Leigh Sharpe wrote:
> 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.

It smells quite similar to this bug report:
http://rt.cpan.org/Public/Bug/Display.html?id=37700

Perhaps try applying the patches from there and see if it solves the 
problem?

-- 
Strategic Data Pty Ltd
Ph: 03 9340 9000


More information about the Melbourne-pm mailing list