Chris Lyon wrote:
> I seem to be erroring out @ the $session->login portion of my program
> because the module that I am call is saying the password/username is
> bad. How do I trap the error and exit cleanly without just dumping
> from the application:
> 
> 
> login failed: access denied or bad username at ./cisco.pl line 47
> 
> $session = Net::Telnet::Cisco->new(Host => $ip);
> $session->login($login, $password);
> 

You may want to check the 'errmode' method of Net::Telnet. Otherwise you
can catch the die in the normal Perl exception handling way,

perldoc -f eval

my $return = eval { # some code that might die };
if ($@) {
  print "Uh oh, croaked leaving only: $@";
}

# code after not croaking

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to