in reply to Re^8: How to solve Pseudo terminal issue OpenSSH
in thread How to solve Pseudo terminal issue OpenSSH

my ($pty, $pid) = $ssh->open2pty();
See the section about integrating with Expect on the module documentation.

In any case, you should investigate why ssh is requesting a remote tty when it is not requested. That is quite unusual (even if probably harmless).