Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Scheduled event system [a little OT]

by bart (Canon)
on Jun 19, 2009 at 11:56 UTC ( #773000=note: print w/replies, xml ) Need Help??


in reply to Scheduled event system [a little OT]

What are the normal design patterns for a thing like this -- populate a database with multiple dates when a recurring event is added?

Well, the way I would do it, is to calculate when the next event will occur, and then schedule that. When that event is triggered, you can calculate the next occurrence. So there is never a need to store more than one date.

As for the exceptions list... You can use cron as the base, but instead of a command line, you store a symbolic name... or an ID. Specify the associated command line separately. You can have more entries for one name, and give each a precedence, pretty much just like the filter rules for an email/usenet client. Specify what you want to happen: run, or suppress. The first rule that triggers specifies what will happen at that specified time. And when the verdict is to suppress, you'll have to calculate the next occurrence after that time...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://773000]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2020-10-26 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (251 votes). Check out past polls.

    Notices?