My code as below
use Net::SSH::Expect;
my $ssh = Net::SSH::Expect->new (
host => "$node_name",
user => 'admin',
timeout => 10,
raw_pty => 1,
);
$ssh->run_ssh() or die "SSH process couldn't start: $!";
$ssh->waitfor('password: ');
$ssh->send("$password");
$ssh->waitfor('mml> ');
@ls=$ssh->exec("$command");
print @ls;
#BREAK1: At this point remote device ask for "Press Enter to continue..." because output is more than one page..that is why below code
while ($ssh->waitfor('continue')) {
$line=$ssh->send("\n");
print $line;
}
I want to print all the output captured, however it prints only which is captured by @ls=$ssh->exec("$command"); and it do not print anything which is captured by code below BREAK1.
Perldoc of the module reccomends following when output is large:
Also note that send() is not supposed to return anything, you should use read_line() or read_all(). Module doc