Net::SFTP::Foreign Transferred Bytesby yulivee07 (Sexton)
|on Apr 26, 2016 at 13:24 UTC||Need Help??|
yulivee07 has asked for the wisdom of the Perl Monks concerning the following question:
Hi fellow Perlmonks! I am currently having fun with Net::SFTP::Foreign. I am modifying a deamon which monitors a directory and automatically uploads files via sftp to a server. If there are multiple files, the deamon forks a child process for every file and transfers them in parallel.
Now I want to do some better error handling. Wenn a transfer aborts, I want to print the number of bytes which were transferred. I can quite get this to STDOUT with the "more => -v" option.
My first approach was, to grep that output for the "Transferred" line. While this does work, that seems a bit overkill.
I also tried utilizing the callback function of sftp->put like this:
However this is giving me a hard time, as I would have to track a variable per child I fork.
I hope I am not missing something from the documentation for getting the transferred bytes from Net::SFTP::Forerign.... Any Ideas? I get the feeling I am nearly there with the callback-solution...