use POSIX qw/EAGAIN EFBIG ENOSPC/; # stuff unless (defined(syswrite($socket,$buffer))) { # Oops, didn't write. How come? if ($! == EAGAIN) { # Nonblocking and socket not yet ready... } elsif ($! == EFBIG) { # Writing to a file that is too big for our filesystem. } elsif ($! == ENOSPC) { # Ooops, writing to a file and the disk is full. } else { # One of the other dozen or so reasons a write can fail. } } #### unless (defined(syswrite($socket,$buffer))) { # Oh dear, couldn't write. Could it be that I'm # no longer connected? if (defined(getpeername($socket))) { # Yup, they're still there. Must be a different error. } else { # Oops, the other side went away. } }