Try creating a pipe and passing the read side as the stdin stream.
In reply to Re^6: Net::OpenSSH + CGI problem by salva in thread Net::OpenSSH + CGI problem by fwalters