- fork a process (the forked process will do something and create a file /tmp/completed.txt. Then, it terminates normally. - main process checks the existance of /tmp/completed.txt - if completed.txt exists within 5 minutes, main process continues - if completed.txt do not exist within 5 minutes, the forked process is killed. Then, main process continues.

Don't use completed.txt; loop on waitpid() in the parent after the fork(), sleeping a few seconds between calls. If you're still "wait"ing after 5 minutes, you can kill your child process (since you know it's pid from the return from fork(). Check out recipe 16.2 from the O'Rielly Perl Cookbook (link to pirate copy deleted) (pdf) or read the perlfork perldoc. Be advised that if this is production code, there are plenty of error cases to handle (e.g., restart-after-failure, double-start, race conditions, etc., etc.).

BTW, this seems like something that should have been wrapped into a module long ago. Anyone out there know of a lightweight asynchronous dispatch package? My short search came up dry.