Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Overview


Net::Telnet is a very easy to use module for most tasks requiring telnet. It has an OO type interface that works very well for what I have used it for and it crosses platforms easily.

The Meat

I haven't actually gone through the code enough to do a review on the actual code, but what I have seen is well written and easy to follow. There are extensive help pages that are also well written and easy to follow.

I have used this module successfully on both FreeBSD and Win2k with only one glitch (see below). I have used it with great success in child processes on FreeBSD as well as "compiled" it into a freestanding .exe for Win2k. Everything worked great "out of the box" and there was only one wrinkle to iron out.

I've used it connecting to several different devices including Cisco 2511 comm servers, Cisco switches and routers (CatOS and IOS), Foundry switches, Nokia IPXXX and Nokia CCXXX boxes. All worked great with the exception of a few tweaks required for the Cisco comm servers. I have also used it for Telnet access to FreeBSD machines for remote control purposes and it handles this very well.

Update: First, thanks to rob_au for the fix below and Second, I updated some of the text.
Update 2: There is a new version (3.03) of Net::Telnet on CPAN now and the author has *fixed* the issue above. I'm not sure if I like the fix (local $^W = '';), but it will now work without warnings. I did inform the author of the fixes below, however he may have reasons for discarding them and using his method. I don't know what that would be, but there may be something I'm not seeing.

The bugs


Note: These bugs are in relation to the 3.02 version of this module.
I did find a couple things worth mentioning.
  • A bug when running in a script with -w when on a Win2k platform, I traced down the warning to a > comparision, but was not able to fix it for some reason. Seems like it may be an ActiveState bug, but I have not debugged it further...YET! The workaround I used is in this code:
    my $telnetObj = new Net::Telnet (Timeout => 20, Prompt => '/[^ <-]\>/' +, Errmode => "return") ; my $tmp = $^W ; local($^W) = 0; $telnetObj->open(Host => $gw_in_addr) ; #offending code in here $^W = $tmp;
  • The author was not responsive to this issue at all.
  • The other issue was a sync problem with the Cisco comm server. however I found that feeding a known bogus command and junking the output would usually sync me back up.

    Conclusion


    It beats anything else out there. It has a great interface and I find it works much easier than expect for small jobs. The fact that it "compiles" into a freestanding .exe in Win2k, and works in child processes also attests to the stability in my mind.

    If you need telnet...Net::Telnet is the only way to do it via perl.

    In reply to Net::Telnet by Rex(Wrecks)

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



    • Are you posting in the right place? Check out Where do I post X? to know for sure.
    • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
      <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
    • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
    • Want more info? How to link or How to display code and escape characters are good places to start.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others perusing the Monastery: (6)
    As of 2024-03-29 01:19 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found