#----- # handle SIGPIPE ourselves, so we don't get killed $SIG{PIPE} = sub { warn "BROKEN PIPE\n" }; if (my ($w) = IO::Select->new($wh)->can_write()) { if (print $w "$msg\n") { print "wrote '$msg' to $w ('| @cmd')\n"; close $w; } else { warn "print to $w FAILED\n"; # we'll have gotten a SIGPIPE, too } } else { warn "$wh not ready for writing\n"; } #-----