eval { $sftp = Net::SFTP->new($host, %args) }; die "Connection failed: $!\n" if $!; die "No SFTP object\n" unless $sftp;