On Fri, Jul 25, 2003 at 01:52:33AM -0400, Thomas wrote:
> Hello,
> 
> I've been using POE and POE::Component::IRC for a couple weeks, working
> on an IRC bot for our office. My bot is mostly complete now, but I wanted
> to add some functions that get executed every X minutes, and one that
> executes every night at midnight.
> 
> In the _start() function of my script (which is called by the P::C::IRC
> module), I have this call:
> 
> $kernel->delay_set(do_every_10 => 600); # call this function every 10 min
> 
> I have a function in my script called do_every_10(), but it never gets
> executed. Another side effect is that pressing CTRL-C does not call my
> sigint handler function as long as I have this delay_set call in my
> script. If I comment it out, CTRL-C works as expected with sigint.
> 
> I've also tried my alarm_set call to set a midnight timer, and this too
> never gets called:
> 
> $kernel->alarm_set('do_every_day' => &UnixDate(Date_GetNext('today', 
> undef, 2, '00:00:00'), '%s'));
> 
> (That uses Date::Manip to get midnight tonight and return it as seconds
> since the epoch.)
> 
> I am assuming my problem has something to do with trying to combine these
> alarms with the use of P::C::IRC. How do I get them to work together?

The usual problem is that you haven't set up a do_every_day or
do_every_10 handler.  In P::C::IRC, there's a POE::Session->new() or
->create() call that lists all your event handlers.  If you add
do_every_10 and do_every_day, they should get called.

Note, though, that alarm_set() does not set recurring alarms.  You'll
need to add another alarm_set() call to do_every_10() and do_every_day()
to make them repeat.

-- Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/

Reply via email to