in reply to Re^2: Trying to capture an error using NET::TELNET
in thread Trying to capture error message using telnet::net

eval { connect ... }; warn "The server is unreacable? $@" if $@;

Replies are listed 'Best First'.
Re^4: Trying to capture an error using NET::TELNET
by tprizler (Novice) on Sep 02, 2008 at 12:04 UTC
    Hi,

    I did :

    eval { my $telnet = new Net::Telnet ( Timeout=>10,Port => $console_por +t ,Errmode=>'die'); $telnet->open("$console_server"); }; warn "The server is unreacable? $@" if $@;

    But got a lot of error like :
    Global symbol "$telnet" requires explicit package name at ./connect_telnet.pl line 3
    What can i do??

      Most probably, you're just not declaring $telnet in a sufficiently large scope: the code you pasted above, as of itself is fine.

      --
      If you can't understand the incipit, then please check the IPB Campaign.
      Fix it.