in reply to Net::Telnet error trapping
errmsg() returns the error of the Net::Telnet object itself, not that of the command/script you executed. For example:
use Net::Telnet; use strict; use warnings; my $t = new Net::Telnet(timeout => 10, Errmode => "return", Prompt => +'/\[AAUA1\]/'); $t->open("ofgaix1"); $t->login("foo", "bar"); print "errmsg: " . $t->errmsg . "\n";
Host ofgaix1 does not exsit, and when I tested it, it printed this:
errmsg: login failed: filehandle isn't open
The error message if they get printed on the server side, then they are returned from cmd() call in an array, together with all other print outs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Net::Telnet error trapping
by Anonymous Monk on Dec 23, 2007 at 08:33 UTC |