|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This tracker defines the following observables:
"scheduled alarm"
But it is suggested not to use the usual tracker observe/unobserve API, but to use the schedule/deschedule/reschedule API instead.
This tracker uses the fvwm command Schedule to get a notification. It is possible to use the perl alarm. This is the default if the module is run in the dummy mode. To set it explicitly, pass UseAlarm boolean value when the tracker is created. Note that alarm signals are not relable in some perl versions, on some systems and with some kind of applications, don't expect the alarm method to work at all.
# beep every 40 seconds; exit in 100 seconds
my $scheduler = $module->track("Scheduler");
$scheduler->schedule(40,
sub { $module->send("Beep"); $scheduler->reschedule; });
$scheduler->schedule(100, sub { $module->terminate; });
The callback parameters are: hash as returned using data when called with the scheduled-id parameter, and optional params.
Returns scheduled-id that may be used in deschedule or data.
This may be useful when defining a periodical callback that should be, say, called every 10 minutes (600 seconds).
sentTime - unix time (seconds since 1970)
seconds - requested alarm seconds
fvwmId - internal I<fvwm>'s Schedule id
callback - alarm callback, CODE ref
params - ARRAY ref of optional callback parameters
If no scheduled callbacks are active, the empty string is returned as expected.
Last modified on August 26, 2005