in reply to net::sftp dies in the middle
The first thing I would do is make sure that you can do an sftp from the command line of $local_file to $remote_file. Since you didn't show the code that sets these variables, I can't be sure they're set the way you expect. Since it's an open problem, the first thing i would verify that this user can write this file in this location. If you have access to the server, you can usually restart it with debugging turned on. It will probably log open/write errors on its side
fnord
In Section
Seekers of Perl Wisdom