Dear Monks,

First post here. Pretty new to Perl as well, been working with it for about 6 months.

I am using the Net::Telnet module in some of my code. Running on Wintel, Active State V5.8.8.

I am using Net::Telnet with the error mode set to 'return'. When an error occurs, I check the errmsg string. More often than not, I get something like this 'read error: Unknown error'. Not terribly helpful. I Googled around and read through the docs but I am wondering if there is any more information that I can obtain about the nature of the error (such as maybe the winsock error code).

I have considered setting the error mode to 'die' and then just wrapping the code in an eval block but that's less than ideal in the environment I am in.

Thanks in advance for your help!

-Adam Update:

$self->{logger}->info("Running cmd on device $self->{device}: '$cmd'") +; $self->ethtelnet()->buffer_empty(); my @lines = $self->ethtelnet()->cmd(String => $cmd, Timeout => $timeo +ut, Errmode => 'return'); my $error = $self->ethtelnet()->errmsg(); my $buffer = ${$self->ethtelnet()->buffer()}; if($error) { undef($self->{ethtelnet}); $self->ConnectConsole(); die "Telnet error attempting to issue command '$cmd' to eth port, error:\n$error\nbuffer:\n$buffer"; }


When this code runs I get the following output in the failure case: Test line: 35 Telnet error attempting to issue command 'my_command -j' to eth port, error: read error: Unknown error buffer:

In reply to Net::Telnet Error Info by aps337

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.