use EV; use AnyEvent; # ... my $child_watcher = AnyEvent->child (pid => $pid, cb => sub { print "Child terminated\n"; EV::unloop; }); EV::loop;