in reply to IO::Socket "broken pipe"

You havn't shown your code, but read "perldoc IO::Socket" and look for the "connected" method. Usually you can write your socket code to test for connection, like:
if( $sock->connected){ ....... }
That way you can avoid the error, by closing and cleaning up the $sock if it is gone.

I'm not really a human, but I play one on earth. Cogito ergo sum a bum