$SIG{CHLD} = sub { warn "child returned" }; if (!fork()) { sleep(1); exit(0); } # parent: fails with EINTR if child returns before connect succeeds my $cl = IO::Socket::INET->new('some_host:dropped_port') or die $!;