in reply to Reporting Progress With Net::FTP (was : Net::FTP question)

If you want to do this as the download is happening you can use the filehandle method of Net::FTP...
$| = 1; # autoflush, because we are using \b to overwrite current line my $time = time(); my $FILE = $FTP->stor($filename); my ($buf,$bytes); while(my $bytecount = $FILE->read($buf, 10024)) { $bytes += $bytecount; print "\b",($bytes/(time()-$time+.01),"b/s"; # .01 to prevent divide + by zero }
This is by no means tested, and, could probably be tweaked much better, but it gives the idea.

I not sure but maybe Benchmark's timeit function would be a good way to get back the time the $FTP->get takes, as well... rather than grabbing POSIX::times... that is if you want better than a second granularity :)

                - Ant
                - Some of my best work - (1 2 3)