in reply to Re^2: How can I test TCP socket status in Perl?
in thread How can I test TCP socket status in Perl?

If $sock is not defined you are not connected, so you should test for that as well:
sub AmStillConnected { return unless defined $sock; return unless $sock->connected; return 1; }

Replies are listed 'Best First'.
Re^4: How can I test TCP socket status in Perl?
by beanscake (Acolyte) on Jul 27, 2015 at 00:07 UTC
    thank you this worked work me.
      This may 'work' but be aware that your call to connected() isn't really achieving anything. You should be testing the success or failure of each individual read/write to the socket anyway.

      If you have found all ready the solution to your question, please post the complete code. So other people will benefit in future.

      Seeking for Perl wisdom...on the process of learning...not there...yet!