Folks-

I'm just beginning my journey at the monastery, although I've been programming in perl for a few years now. Recently, I've decided to try and enhance an existing perl module Re^2: Using SSH via SOCKS5 Proxy, and salva made a good design suggestion Re^3: Using SSH via SOCKS5 Proxy.

I could simply hack the Net::SSH::Perl module to use Net::SOCKS when requested, but salva suggests to make it more general. I take this to mean that a user should be able to specify a given module to use (something like $ssh->proxy(Net::SOCKS, $ip, $port).

Obviously, this means there has to be some way to "plug" the SOCKS module into the SSH module (like tinker-toys). What is the best way to do this?

Am I even on the right track?

Maybe it just makes more sense to do something like:

ssh->proxy( sub{ require Net::SOCKS; my $sock = new Net::SOCKS (...); ... return($sock); });
for setting up the proxy, and then just have SSH send/receive everything through the $sock, once it's setup.

How have others solved this type of problem? My goal is to provide the module author with a viable solution for consideration in making it official. Any direction is much appreciated!

Thanks

-Craig

Replies are listed 'Best First'.
Re: Module Tinker-Toy-ification
by erroneousBollock (Curate) on Sep 12, 2007 at 15:28 UTC
    By more general I would have understood: "make it work for anything that uses IO::Socket::INET".

    -David

      David-

      Excellent response! Many thanks.

      You knocked my thinking molecules into a different, and much better configuration to think about this problem more clearly.

      I will let this problem cook a bit more, while I ask for the author's advice. I hope to have something that both works, and makes sense, sometime soon.

      -Craig