In role Scheduler§
See primary documentation in context for method cue.
method cue(&code, Instant :$at, :$in, :$every, :$times = 1; :&catch --> Cancellation)
Schedules a callable (&code) for execution and returns an instantiated Cancellation object to cancel the scheduling of the code for execution (which is especially important if you specify the :every ( time ) named parameter). The adverbs control when and how the code is run:
$atcan be anInstantbefore which the code won't be run. Alternatively$inis the number of seconds (possibly fractional) to wait before running the code. If$atis in the past or$inis negative, the delay is treated as zero. Implementations may equate to zero very small values (e.g. lower than 0.001s) of$inor result of$at- now.If
$everyis specified, it is interpreted as the number of seconds (possibly fractional) to wait before re-executing the code. Implementations may treat too-small values as lowest resolution they support, possibly warning in such situations; e.g. treating0.0001as0.001.$timestells the scheduler how many times to run the code.&catchis called with theExceptionas its sole argument if&codedies.If
$ator$inareInf,&codewill never be run; if$everyisInf,&codewill only be run once. If any of the three are-Inf,&codewill be run immediately. If any of the three areNaN, anX::Scheduler::CueInNaNSecondsexception will be thrown. This only applies to releases 2019.05 and later.
One should call the cancel method on the returned Cancellation object to cancel the (possibly repeated) cueing of the code.