I recommend a specialized proxy like autossh that maintains the connection for you. Your local script would connect to the local tunnel; autossh manages the tunnel for you. I am not sure what App::assh gives you other than a "less awkward" interface to autossh, but it's on CPAN nonetheless.