in reply to Timer Question

perldoc -falarm

Replies are listed 'Best First'.
Re^2: Timer Question
by ikegami (Patriarch) on Feb 16, 2006 at 18:59 UTC

    That's didn't work prefectly.

    $ perl -e 'alarm(5); system("sleep 10; echo awoke")' Alarm clock $ awoke

    system was interupted, but the command kept executing.

      Depends on what is meant by "system call".

      If it's system call, it's a call to the OS, like sysread, in which case alarm works exactly as required.

      If it's "system() call", then things are different: system() forks a process, executes whatever's specified (different for single/multiple arguments), waits until the command is completed and then returns. It won't kill the spawned process, that's why it will run until the end.

        oh, yes, it does look like I misread the OP.
        it is a "system() call", how can I kill this after a certain amount of time...will alarm work per the other responses... Your help is greatly appreciated.