if( $pid = fork ) { alarm $timeout; waitpid( $pid, 0 ); } else { exec( $command ) || die( "Couldn't exec $command" ) }