in reply to Net::SSH::Perl hanging on creating object

Do you get the feeling that you maybe forgot something? It hangs because you haven't told it to do anything. Here's an example that I used to ping ftp.cpan.org:
#!/usr/bin/perl use strict; use warnings; use Net::SSH::Perl; my $host = 'ftp.cpan.org'; my $user = 'anonymous'; my $pass = 'anonymous'; my $cmd = exec("ping", "$host"); my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my ($stdout, $stderr, $exit) = $ssh->cmd($cmd); print $stdout, "\n";
I really like this module, and I've to decided to contact the module's author to see if he can use a co-maintainer. It'll work for you, but only if you work for it:).

Replies are listed 'Best First'.
Re^2: Net::SSH::Perl hanging on creating object
by salva (Canon) on Jun 09, 2011 at 08:44 UTC
    It hangs because you haven't told it to do anything
    Not really. If you don't tell it to to anything, it will not do anything, but it will not hang either. It will just silently drop the connection when the script exits.
    $ time perl -MNet::SSH::Perl -E '$ssh=Net::SSH::Perl->new(localhost, d +ebug => 1); say "connected!"' topo: Reading configuration data /home/salva/.ssh/config topo: Reading configuration data /etc/ssh_config topo: Connecting to localhost, port 22. topo: Remote protocol version 2.0, remote software version OpenSSH_5.8 +p1 Debian-4ubuntu1 topo: Net::SSH::Perl Version 1.34, protocol version 2.0. .opo: No compat match: OpenSSH_5.8p1 Debian-4ubuntu1 topo: Connection established. connected! real 0m0.263s user 0m0.200s sys 0m0.010s