in reply to SSH2 with SOCKS5 proxy
You can pass an open socket to Net::SSH2 connect instead of the host/port pair.
So you can create the socket, connect to the proxy and do the SOCKS5 handshake yourself and then call $ssh->connect($socket).
If you are on Linux/Unix you could even use an external program as socat to do the handshaking for you.
In Section
Seekers of Perl Wisdom