Best pick for time-based 'event' looping?
Randy J. Ray
rjray at blackperl.com
Thu Apr 16 02:16:56 BST 2009
I might be using the wrong tech-terminology here, so bear with me...
What I'm looking for is a best-of-breed sort of CPAN solution for a job-queue
processor in which the jobs are run based on time. Not quite "cron", mind you,
but not too different from that. In essence:
1. Init job queue
2. Add first task, which should happen immediately
3. (Loop starts here) Queue/Event-handler knows how long it has to
wait before peeling the next task off the head of the queue and
processing it.
4. Task runs, might insert some new, different tasks with their
own offset-from-now values expressed in seconds. For example, the
main task re-inserts itself to run again in 15 minutes, after it
has checked a certain RSS feed for Last-Updated and possibly read
it and parsed it.
5. Loop back to #3
6. Profit (this step is never actually reached)
Right now, the application (the twitter-bot behind the "cpan_linked" Twitter
account) has a really clumsy time-based loop. I'm planning on adding some more
functionality to it (anwering @-messages, allowing me to control it remotely
with direct messages, etc.), and it would be a good time to replace this loop
with something less, well, hideous. Something I wouldn't be embarrassed to have
on CPAN...
Randy
--
rjray at blackperl.com
More information about the london.pm
mailing list