laziness, impatience, and hubris | |
PerlMonks |
Re: Perl Script to Test Telnet Connectivityby LanX (Saint) |
on Nov 08, 2022 at 22:12 UTC ( [id://11148051]=note: print w/replies, xml ) | Need Help?? |
Welcome to the monastery! :) DISCLAIMER: I never used that module! But it's obvious that your use of exists on scalar values is weird. from this documentation of Net::Telnet ... > When mode is "return" then the method generating the error places an error message in the object and returns an undefined value in a scalar context and an empty list in list context. The error message may be obtained using errmsg(). ... I suppose you want to used defined instead. FWIW: Another way is to keep the error-mode "die" and to catch the exception with a surrounding block eval (that's a try-catch in newest Perl). Like that you'd get better diagnostics what went wrong. Hope this helps! :) Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|