Re: Custom-interval timer not working: what am I missing?

[email protected] (Jeff Boes) Thu, 31 Mar 2005 20:11:06 -0500
Newsgroups perl.loop
Organization Nexcerpt, Inc.
Message-ID <[email protected]>
When I woke up, Jochen Stenzel was saying:

>you are calling loop(), don't you? It shouldn't be necessary to use
>the start() method then ... But my first intuition was to suggest the
>use of "interval" instead of "at" (just from remembrance).
>
>  
>

Right; but I don't want the event to run every 5 minutes. Instead, I 
want to service an event, then calculate (actually, search a database 
for) when the next event is to go off. Then set the timer to expire at 
that time.

What I determined through experimentation is that you can set up a 
one-shot timer event, and then by doing --

$e->stop;
$e->at(time + $next);
$e->start;

I dunno why the "stop" call is necessary, but the event won't fire a 
second time without it!

-- 
Jeff Boes                                         Vox 269-226-9550 x24
Director of Software Development                  Fax 269-349-9076

Exfacto!         Exceptional Online Content     http://www.exfacto.com
Nexcerpt         ...Extend Your Expertise...    http://www.nexcerpt.com