From: rahed on
"CsB" <CSB001(a)gmail.com> writes:
> Is there something special I need to do to utilize the existing open
> connection for subsequent commands? Or, am I way out in left-field on
> ths problem?
>
> Any suggestions or advice would be greatly appreciated.
>
> - - BEGIN - SCRIPT - - - - - - - -
>
> use Net::SSH::Perl;
> use strict;
> use warnings;
> my $host = "example.host.com";
> my $user = "username";
> my $password = "password";
> my $cmd = "ls";
> my $ssh = Net::SSH::Perl->new(
> $host,
> debug => 1,
> protocol => '2,1',
> port => 22
> );
> $ssh->login( $user, $password );
> $ssh->register_handler(
> "stdout",
> sub {
> my ( $channel, $buffer ) = @_;
> print "I received this: ", $buffer->bytes;
> }
> );
> $ssh->cmd($cmd);

I don't use register_handler method but you can run more commands with
cmd method like this (from docs) ($out,$err,$exit) = $ssh->cmd($cmd);
It's limited to ssh-2 protocol.

I run your code whithout problems. I think you should upgrade openSSH,
2.9 is quite outdated.

HTH

--
Radek
From: rahed on
"Mumia W. (NOSPAM)" <paduille.4060.mumia.w+nospam(a)earthlink.net> writes:

> Maybe, maybe not. I advise against using Net::SSH::Perl. Others have
> noted it to be buggy, and I consider it to be overly complicated and
> perhaps a reduction of system security.

I use the module quite frequently and for my usage haven't noticed any
bugs. Complicated can be the installation because there are many
prerequisite modules.

--
Radek
From: CsB on
On Feb 8, 7:42 am, rahed <rah...(a)gmail.com> wrote:
> I run your code whithout problems. I think you should upgrade openSSH,
> 2.9 is quite outdated.

Thank you. The remote system is a network switch. It's not under my
jurisdiction so I have no control over its software release. I think
it may be the problem.