XP is just a number | |
PerlMonks |
Re: Run subroutine occasionallyby stevieb (Canon) |
on Mar 01, 2022 at 18:59 UTC ( [id://11141735]=note: print w/replies, xml ) | Need Help?? |
My Async::Event::Interval does this. It takes a callback as a parameter, and runs it at a given interval (in seconds). The callback is run in a separate process. Example:
Output:
An interval (first parameter to the new() method) of 0 (zero) will only run the routine once, but you can run it again at any time by calling $delayed_event->start if $delayed_event->waiting;. Floating point intervals are also supported if one needs such granularity.
In Section
Seekers of Perl Wisdom
|
|