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: