Best pick for time-based 'event' looping?

Paul LeoNerd Evans leonerd at
Thu Apr 16 11:00:30 BST 2009

On Wed, 15 Apr 2009 18:16:56 -0700
"Randy J. Ray" <rjray at> wrote:

> 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)

IO::Async could make easy work of that

specifically, you'll be wanting something like

  use IO::Async::Loop;
  my $loop = IO::Async::Loop->new();

  sub take_over_world
    print "Same thing we do every day Pinky...\n";

      delay => 3, # in seconds
      code  => sub { take_over_world() },



Paul "LeoNerd" Evans

leonerd at
ICQ# 4135350       |  Registered Linux# 179460
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the mailing list