I have a Perl script which access a remote machine using openssh and executes a Perl script in that remote machine.
Now the problem is that the script which needs to be executed in remote machine is an interactive script and expects some input during execution through STDIN.
Could some one help me with the implementation of this scenarion.
I am placing the snippet of code which I have implemented till now.
my $ssh = Net::OpenSSH->new("$host", timeout => 60) or die "unable to connect to remote host: ". $ssh->error;
$ssh->system("chmod 755 abc.pl");
my $output=$ssh->capture("./abc.pl") or die "remote command failed: " . $ssh->error;
captureprovides the optionstdin_datafor that. If the interaction is complex, you may like to use Expect instead. Read the module documentation!