Hi,

after doing all advice theoretically (I'm not a network admin), I coded a small test to see where the problem is:

1 #!/usr/bin/env perl 2 use 5.010; 3 use strict; 4 use utf8; 5 use warnings qw(all); 6 7 use local::lib 'cisco'; 8 9 use Net::Telnet::Cisco; 10 11 my $session = Net::Telnet::Cisco->new( 12 Host => "192.168.168.2", 13 Timeout => 3, 14 ); 15 $session->login(Password => 'secret');

A run of that shows:

problem connecting to "192.168.168.2", port 23: connect timed-out at a +m304.pl line 11

AAAAHHH, the exception is thrown on line 11. It seems that the method new is doing a connect to host mentioned. IMHO that's an API misdesign, but anyways.

Conclusion:

BUT: Now the interesting part. Putting an eval around the method new can catch the exception, but not the exception message. And that's worth another thread herein.

Best regards
McA


In reply to Re: Cisco Telnet by McA
in thread Cisco Telnet by mvip

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.