in reply to Detect whether a writeable filehandle has closed?
Even if it were possible to check whether the pipe was still valid before writing to it, doing it would be a bad idea. You would be introducing a race condition as the child could die after you check the pipe but before the write operation is completed. In general, that's a bad programming practice.
The right think to do is to catch the signal or the error (see ikegami's post above).
|
---|
In Section
Seekers of Perl Wisdom