Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Call function no more than every 0.1 secondsby Fletch (Bishop) |
on Aug 12, 2020 at 04:16 UTC ( [id://11120640]=note: print w/replies, xml ) | Need Help?? |
Possibly overkill for this situation but in a more general case an event loop like POE (or AnyEvent or EV or Mojo::IOLoop or . . .) might be useful (especially if you're going to need to handle other timing, or react to outside IO events (network traffic, IO from files, . . .). You'd call your routine in an event handler, then after it returns request to be delivered the same event to yourself after the requisite delay (starting things off immediately sending yourself the event). Edit: Mojo version.
The cake is a lie.
In Section
Seekers of Perl Wisdom
|
|