I want this to happen every 10 cycles.
I want this to happen every 30 seconds.
We've all done it the ugly way:
while (<>)We've all stored time() somewhere:
This is simpler:
use Every;This is simpler too:
use Every;every(10) fires at 10 and up, not at 0. This is a feature but I
can add an option to override it. I have not needed it and Jerrad
Pierce, who suggested it, said he doesn't need it either.
The time-based counters are in seconds only. It's trivial to put in
millisecond counters with Time::HiRes but I have not needed them.
Multiple every() calls on the same line: no problem.
Devel::CallSite will identify the call site uniquely. You can,
however, supply your own identifiers as a list to every() if you
need more control, but you can't (currently) reuse the same counter.
I can add that if anyone needs it but so far I haven't.
Just use it. Maybe it will be in the core some day.