in reply to Re: Net::SSH2 Interactive command example
in thread Net::SSH2 Interactive command example

I think the reason that Net::SSH::Perl::Buffer was slow was that the compression level might have been too high. You can use Net::SSH::Perl::Comp to set the compression level lower. For example,

my $comp = Net::SSH::Perl::Comp->new('Zlib',1);

sets the compression level to 1, the valid levels being 0 to 9. The default is 5.

Replies are listed 'Best First'.
Re^3: Net::SSH2 Interactive command example
by Anonymous Monk on Apr 26, 2013 at 11:52 UTC
    Hello everyone I have been trying to use this kind of scripts to connect to a remote machine and execute some commands. I think the connection is well done, but the execution of commands is not working for me. This particular case is about: 1.- I connect via ssh to a linux machine 2.- I enter in a special mode with MML commands (machine to man language) typing 'mml' 3.- I do staff with this mml commands My script is failing in step 2. I just want to send this "mml" and it's not working :( :(
    if( $ssh2->connect($host) ) { if( $ssh2->auth_password($user,$pass) ) { print "connected.....\n"; #shell use my $chan = $ssh2->channel(); $chan->blocking(0); $chan->shell(); print "sending command....\n"; my $num = 10; while($num--){ sleep(1); } print $chan "mml\n"; select(undef,undef,undef,0.2); print $buf while ($len = $chan>read($buf,512)) > 0;
    I tried with several methods: print $chan, exec ('comand'), everything in this thread... but still not working. Any idea?