|
|
| Perl: the Markov chain saw | |
| PerlMonks |
Re^2: Capturing SSH output in an array.by salva (Monsignor) |
| on Nov 15, 2012 at 09:37 UTC ( #1003982=note: print w/ replies, xml ) | Need Help?? |
|
Net::SSH::Any is still a work on progress and the documentation is quite lacking, but the API is mostly a subset of that of Net::OpenSSH (IIRC, new, system, capture, capture2, error and scp methods are supported) so you should read its docs. The new method returns always an object, even when the connection fails. You have to use the error method to check for errors. In order to use public key authentication, use the constructor option key_path to pass the path of the file containing the private key to Net::SSH::Any.
Update: BTW, the module should be as fast as any other SSH client implementation (i.e. PuTTY or OpenSSH). Connecting to some machine in the same (or a near) LAN should be a sub-second operation. Maybe sshd is configured on the Centos machine to use ident or your DNS configuration is broken or you have any other network problem or the host supporting the VM is overloaded.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||