in reply to program dies when printing to closed socket, I think

Yes, by default writing to a closed socket will cause your program to receive a SIGPIPE, which by default will kill it. (See 'man 2 write', search for EPIPE).

You can ignore or handle the signal (see %SIG in perldoc perlvar), in which case you'll get an error returned from the write and $! will be set to EPIPE (in a numeric context, or the error string in a string context).

Linux is giving you some default error handling (killing your process via SIGPIPE), if you want something more complex you'll need to check for and handle errors as above. Good luck.

Replies are listed 'Best First'.
Re^2: program dies when printing to closed socket, I think
by HansB (Initiate) on Aug 16, 2007 at 16:51 UTC
    Thanks! I wrote a quick catcher for SIGPIPE and it's handling client disconnects just fine now.