chananf has asked for the wisdom of the Perl Monks concerning the following question:

I'm hoping to retrieve I/O transfer stats after executing $ftp->put($file);. Something akin to below:

ftp> put test2.txt
200 PORT command successful.
150 ASCII data connection for test2.txt
(151.139.14.78,1425).
226 Transfer complete.
ftp: 18 bytes sent in 0.00Seconds 18000.00Kbytes/sec.

$ftp->message() does not seem to provide this data
Really appreciate if anyome knows!

Replies are listed 'Best First'.
Re: $ftp->put() transfer stats
by Fletch (Bishop) on Jul 30, 2010 at 18:26 UTC
    • Store off the time before you start your put (possibly using Time::HiRes if you want more precision)
    • Call put
    • Subtract the current time from the start time
    • Divide the size of what you sent by the duration
    • Profit!

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Thank you - that is good to know!
      Also,I would like to get # bytes transferred
      We have a client that thinks we are sending zero byte files
      Now, we do along the following to verify # bytes sent :

      ftp->put($file, $remote_name);
      ftp->size($remote_name);


      I would prefer if we could get a diagnostic from the ftp object with num bytes sent
      Thanks!