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

Dan Tyrrell dan at jumbuk.com
Tue Oct 21 21:16:44 PDT 2008


---------- Forwarded message ----------
From: Dan Tyrrell <dan at jumbuk.com>
Date: 2008/10/22
Subject: Re: [Melbourne-pm] Strange behaviour from Net::TFTP
To: Leigh Sharpe <lsharpe at pacificwireless.com.au>


Hi,

I sent something similar to his on Friday but it seems it never
arrived (I checked the archives - apologies if this is a repeat.)

http://rt.cpan.org/Public/Bug/Display.html?id=40243

Dan


008/10/17 Leigh Sharpe <lsharpe at pacificwireless.com.au>:
> 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
> web www.pacificwireless.com.au
>
> _______________________________________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://mail.pm.org/mailman/listinfo/melbourne-pm
>



--

Cheers,

Dan Tyrrell

24 Jackson St, Northcote, 3070 Australia.
Mobile: +61 409 964 694
dan at jumbuk.com



-- 

Cheers,

Dan Tyrrell

24 Jackson St, Northcote, 3070 Australia.
Mobile: +61 409 964 694
dan at jumbuk.com


More information about the Melbourne-pm mailing list