in reply to Re^2: Trying to capture an error using NET::TELNET
in thread Trying to capture error message using telnet::net
Here's what I do to circumvent this problem (I know this is an old post...this allows for logging if you are using print FILE ... ):
$fail = sub { print "failed" };
$telnet->open(Host => $server, Port => $port, Errmode => $fail, Timeout => 5);
print "success" if ($telnet); # return works here, but I can't get return to work correctly in the sub)
I'm trying to get the actual error message to differentiate between dns issues vs. bad port. Think I'll try eval. This is inside another module, so printing is not adequate.