io_sock.t works by forking a subprocess it can communicate with.
It has the subprocess wait for the main process by sleeping 10
seconds or until an alarm arrives.
With my setup, the alarm signal arrives *before* the child
has a chance to ignore the alarm signal.
I fixed this by moving the "$SIG{ALRM} = sub {};" up before the
fork. It does not hurt to have the parent ignore alarms, too.
use IO::Socket;
$port = 4002 + int(rand(time) & 0xff);
+$SIG{ALRM} = sub {};
$pid = fork();
# Wait for a small pause, so that we can ensure the listen socket is setup
# the parent will awake us with a SIGALRM
- $SIG{ALRM} = sub {};
sleep(10);
$sock = IO::Socket::INET->new(PeerPort => $port,