in reply to Child Net::SSH2 object trouble

For whatever reason, I personally had a difficult time understanding how to use Net::SSH2. But I have had no problems grasping how to use Control::CLI, which uses Net::SSH2 for SSH connections. That might be due to the fact that the syntax for Control::CLI is very similar to Net::Telnet and Win32::SerialPort - both of which I have used previously.

Perhaps Control::CLI can help you accomplish what you're wanting to do or may be its source code could help point you in the right direction with your child class.

Replies are listed 'Best First'.
Re^2: Child Net::SSH2 object trouble
by VinsWorldcom (Prior) on Jun 29, 2015 at 20:30 UTC

    Thanks dasgar!

    You inadvertently forced me to reveal my XY Problem. I have a script that does Net::Telnet::Cisco and I'm trying to add SSH access. While I can get Net::SSH2 to connect to a Cisco router and do what I want, the methods / accessors are all different than in N::T::C, forcing me to have two separate subs rather than an if/then creating a Telnet or SSH object. I thought I'd write a Net::SSH2::Cisco with a similar interface to N::T::C to help - thus my question about adding (N::T::C-like) attributes to the Net::SSH2 returned object.

    Control::CLI looks to have taken the other approach by creating a parent module for both (and more). I'll give it a look!

      Net::OpenSSH can be combined quite easyly with Net::Telnet and derived modules. Unfortunately, you seem to be running your scripts on a Windows box and Net::OpenSSH doesn't work there.