in reply to Re^2: unexpected program abort on write on closed handle
in thread unexpected program abort on write on closed handle
Ok, now the question is---what do I put into the %SIG-handler?For SIGPIPE, perhaps the most common technique (in both Perl and C) is to ignore it and then test the return code of the write, for example:
use Errno ':POSIX'; $SIG{PIPE} = 'IGNORE'; for (1 .. 3) { unless (print SOMEPIPE "blah") { last if $! == EPIPE; # terminate the loop if reader goes awa +y die "I/O error: $!"; # this is more serious, so die } }
|
|---|