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";
}
|