I know this post is quite old, but I thought I'd put an update on this to help anyone who is experiencing the "Broken Pipe" error whilst using Net:SFTP.
The broken pipe error occurs due to the computation of the keys taking so long that the initial secure session to the remote server is closed by the remote server.
The solution (as suggested on other threads) is to increase the speed of the computation by installing Math::BigInt and Math::BigInt::GMP. This means that instead of using the slow Perl installed math module, it uses the far quicker GMP math library.
My initial installation of Net::SFTP took 3 minutes to compute. After installing Math::BigInt and Math::BigInt::GMP, it took seconds. This eliminated the "Broken Pipe" error I was getting.
Hope this helps,
spud