in reply to creative forking (code)

I've had good luck registering a handler for SIGALRM and setting an alarm to go off. like so:
$SIG{ALRM} = \&mp3_player; alarm(1);