local * write_child = sub ($) { my $out=$_[0]; return unless $iopair[1] and ref $iopair[1] and -w $iopair[1]; local * pipe_catch = sub ($) { Debug "Child closed"; $iopair[1] = $iopair[0] = undef; }; $SIG{PIPE}=\&pipe_catch; P $iopair[1], $out."\n"; $SIG{PIPE}='DEFAULT'; };