how about 

 #/usr/bin/perl -w
> 
> use strict;
> use Net::SFTP;
> 
 my ($sftp) = Net::SFTP->new("10.25.3.150", user=>"administrator", 
 password=>"suite100") || warn "connection failed $!";
> if (!$sftp) {
>         print "I can't connect!";
> } else {
>         print "SUCCESS!";
> }
> 


----- Original Message ----- 
From: "Ian Zapczynski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 12, 2002 4:51 PM
Subject: Net::SFTP causes script to exit if connection can't be made


> All,
> 
> I just pulled down the latest Net::SFTP from CPAN and am using it w/ 
> Perl 5.6.1.  I've used the module before and don't *think* I've seen 
> this problem, but I can't say for sure and have only one machine to test 
> it on.  What happens is that if an SFTP connection is refused to the 
> specified host (i.e. the ssh server is down), my script below dies and 
> does not print the failure message I've specified.
> 
> Is this a fault of my environment?  Of the module?  Is there a way that 
> I can prevent this from happening?  If I can't connect to the SFTP 
> server, I cannot allow my script to just die -- I need to send an SNMP 
> message to inform someone of the problem.
> 
> As always, insight is mucho appreciato.  
> 
> 
> #/usr/bin/perl -w
> 
> use strict;
> use Net::SFTP;
> 
> my ($sftp) = Net::SFTP->new("10.25.3.150", user=>"administrator", 
> password=>"suite100");
> if (!$sftp) {
>         print "I can't connect!";
> } else {
>         print "SUCCESS!";
> }
> 
> 
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to