Swank Wiki
Recently Visited

Swank v0.04.04


This is a simple, low-overhead module for running occasional processes in a timely manner. 

For simplicity, rather than relying on a background cron daemon, it relies on the user calling a call_timely function which may or may not do the task, depending on how recently it was last executed.

The drawback is that it can only be executed when call_timely is called, so much more than the given interval could elapse before it is run again.  Nevertheless it works well enough to support the maintenance functions required by various Swank modules.

Requires: Swank::Date


call_timely( executable, [ key=>xxx,] [ time check options ] )

call_timely will run the executable action (in the foreground) if the time check is ok.

executable may be a page.action string, or a code reference

key is a string to use for tracking the last run time.  The default is the executable string, so it is required if executable is a code ref.

background_timely( executable, [ key=>xxx,] [ time check options ] )

This is identical to call_timely, except that it runs the executable action in the background

Time check options

now => 1

Always run the action (useful for testing but not much else)

interval => '7D'

An time interval to wait before running the task again.  Values are from Class::Date::Rel, which means they include one or more of the following:

3Y (year)
1M (month)
3D (day)
6h (hour)
30m (minute)
5s (second)



cleanup old sessions (access time > 1 week)


optimize occasionally