Home
Authors History
Donations Cats
News
News FVWM Logo
Logo Competition
Features
Features
Download
Download
Icons and Sounds
Screenshots
Desktop Screenshots Menu Screenshots
Window Decor Screenshots Vectorbuttons
Documentation
Documentation Man pages
FAQ Developer Info
Mailing Lists
Mailing Lists
Links
Links
Customize
 
 Official FVWM Home Page plain theme

FVWM - Perl library - FVWM::Tracker::Scheduler


FVWM::Tracker::Scheduler

Section: FVWM Perl library (3)
Updated: 2005-08-24
Source: FVWM/Tracker/Scheduler.pm
This page contents - Return to main index
 

DESCRIPTION

This is a subclass of FVWM::Tracker that enables to define alarm callback, several at the same time.

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.  

SYNOPSYS

Using FVWM::Module $module object:

    # 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; });
 

PUBLIC METHODS

schedule seconds callback [params]
Sets the alarm callback that is called in about seconds seconds.

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.

deschedule scheduled-id
Removes the scheduled callback identified by scheduled-id.
reschedule [seconds]
When the scheduled callback is called, it is possible to reinitialize the same callback using the same or different number of seconds.

This may be useful when defining a periodical callback that should be, say, called every 10 minutes (600 seconds).

descheduleAll
Removes all previously scheduled callbacks.
 

OVERRIDDEN METHODS

toBeDisconnected
Calls descheduleAll.
data [sheduled-id]
Returns either array ref of hash refs, or one hash ref if sheduled-id is given. The hash keys are:

    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
dump [sheduled-id]
Works similarly to data, but returns one or many debug lines (one line per scheduled alarm).

If no scheduled callbacks are active, the empty string is returned as expected.

 

AUTHOR

Mikhael Goikhman <migo@homemail.com>.  

SEE ALSO

For more information, see FVWM::Module and FVWM::Tracker.


 

Index

DESCRIPTION
SYNOPSYS
PUBLIC METHODS
OVERRIDDEN METHODS
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 00:51:34 GMT, August 27, 2005

Last modified on August 26, 2005