in reply to Net::Sftp::Foreign writes empty files to FTP server

Net::SFTP::Foreign has a debug mode you can enable adding the following line at the beginning of the script:
$Net::SFTP::Foreign::debug = -1;
Enable it and then post here the output (though, you should take care to remove passwords or any other sensible information from the output)