liamlrb has asked for the wisdom of the Perl Monks concerning the following question:

I want to write a bot using basicbot that simply takes a file containing many previously captured messages and spit them back into a room with a delay specified by the user. Overriding said method isn't working ( at least the way I am doing ) because I don't see any messages until all the messages have been read in, sent to the room and then the event loop get hit again. what is the basic setup to have each message chatted into the room as I read them in? I guess I am asking how can I have control of the program without having to rely on an event to trigger the rest of the program. using tick? many thanks

Replies are listed 'Best First'.
Re: talker bot using basicbot
by Corion (Patriarch) on Apr 20, 2010 at 06:45 UTC

    Bot::BasicBot is written in POE, so there is no way other than events to do something. You cannot do anything in procedural code if you want events to be processed in parallel.

    My approach would be to use a POE::Wheel::Tail maybe to supply a stream of messages, and have some kind of timer fetch a line from that wheel. Maybe you can also just read the next line from the file within a timer callback.

      Thanks for the reply... so it looks like I have use the 'tick' method to read in the message one message at a time and send them out one at a time...