CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
How can I get more info on a Net::Telnet connection error

 



bkimelman
Novice

Jul 28, 2011, 9:17 AM

Post #1 of 3 (3917 views)
How can I get more info on a Net::Telnet connection error Can't Post

Hello,

I am having an issue with a Perl CGI script at the office. We are running Perl 5.8.8

Here is the relevant part of my CGI script

$status = 0;
$prompt = '/#/';
$telnet = Net::Telnet->new(Host => $switch_ip_address, Timeout => 5, Prompt => $prompt,Errmode => "return", Input_log => "$logfile" );
unless ( defined $telnet ) {
report_switch_error($switch_ip_address,"can't establish a connection");
return -1;
} # UNLESS
$telnet->errmode(\&telnet_error_handler);



For the particular switch I am attempting to connect to the connect6ion fails. Since this results in an undefined value being assigned to $telnet I can't use $telnet->errmsg() to get more info. Is there some way I can get more error details ?



Thanks in advance for your assistance.


FishMonger
Veteran / Moderator

Jul 28, 2011, 9:30 AM

Post #2 of 3 (3915 views)
Re: [bkimelman] How can I get more info on a Net::Telnet connection error [In reply to] Can't Post

Have you read the section of the Net::Telnet documentation that talks about errmode?


bkimelman
Novice

Jul 28, 2011, 11:07 AM

Post #3 of 3 (3908 views)
Re: [FishMonger] How can I get more info on a Net::Telnet connection error [In reply to] Can't Post

I did yet more research and reading after I posted my message and I came across a web page that had an example that used the value of "$@" in its error reporting. I tried that and it does indeed give more information.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives