in reply to Timeout on script

For some example code, see Timing and timing out Unix commands and Timing Windows commands.

Replies are listed 'Best First'.
Re^2: Timeout on script
by Anonymous Monk on Jul 09, 2013 at 11:39 UTC
    if you are trying to make alarm clock then you need a call back function for extra module. try to make a script that rotate the functions and check for its timeout. Again if you are trying to do something after reporting timeout.
    my $time_out = 5; my $flag = 1; while(1){ my $diff = time() - $starttime; if($diff >= $time_out){ print "already reached maximum timeout\n"; last; } if($flag){ printData(); $flag = 0; } sleep(1); } sub printData { print "i am running....\n"; }