in reply to higher info lever for MNet::FTP
#!/usr/bin/perl use strict; use warnings; use Time::HiRes qw[time]; use Net::FTP; use constant HOST => 'ftp.perl.org'; use constant DIR => '/pub/CPAN/ports/win32/Standard/x86'; use constant FILE => 'perl-5.6.0.tar.gz'; our $SIZE ||= 4096; my $start = time; my $ftp = Net::FTP->new( HOST, Passive => 1, Timeout => 1, Bytes_read => $SIZE, BlockSize => $SIZE, ) or die "Couldn't connect: $@\n"; $ftp->login('anonymous'); $ftp->cwd(DIR); $ftp->binary; $ftp->ls(FILE); my $size = $ftp->size(FILE); $ftp->quit; open(STDOUT, '>', 'Log.txt'); printf "Got %d bytes at %.3f/second\n", $size, $size / ( time() - $start );
|
|---|