For the code
my $ssh = Net::SSH::Perl->new($host);
$ssh->login($user, $pass);
my($stdout, $stderr, $exit) = $ssh->cmd($cmd);
print "STDOUT: $stdout STDERR: $stderr EXIT: $exit";
If my $cmd is “ls”, then $stdout can have a correct output.
However, if my $cmd is “perl whileTrue.pl”, then how can I have the output while running the perl? In whileTrue.pl, it will print my input in console.
Because if I not ssh to run it, the output will print to the console. However, when I ssh it, I cannot see my output until I really end this process.
Can I have something like flush concept?
Seems like
register_handlermethod allows for non-blocking processing of the output.