I see when you're initializing Net::OpenSSH, you are giving it the username and password there.
Is it possible that bypasses the password prompt (or makes Net::OpenSSH hide it from you) and just drops you at the command line one you are connected and authenticated?