Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need advice on a new POE project

2 views
Skip to first unread message

Celso Barriga

unread,
Feb 7, 2014, 5:53:56 PM2/7/14
to p...@perl.org
Hello!

I just discovered POE while researching on a project I'm about to embark on at work. So I'm new with POE, but a long time Perl programmer. I've read through most of the documentation and tutorial, and now I'm trying to decide what approach to take.

In a nutshell, here's what my program is supposed to do:

0. Log in to an IRC server, at a specified channel.

1. Get some data from our web service that has REST interface. But we already have a Perl module that wraps the REST calls so I don't have to make the REST calls directly. This perl module is using LWP.

2. For each of the data returned from #1, post it to an IRC channel.

3. Wait for some predetermined time (say 60 secs?) and go back to #1.

The data is retrieved through some filter, so there's not going to be a lot of data that will come back.

The program has to be "mission critical" as much as possible, that is, it has to rejoin the channel if kicked out, or reconnect to the server if disconnected.

Here are some of my ideas how I'm going to do it, in order of preference:

1. Use POE::Component::IRC to create a bot, and create a recurring alarm handler in the tick event. During the tick event is when I retrieve data from our web app, and send the messages to the channel. I'm going to use the recurring alarm cookbook example in case this will take a while.

2. Create two separate sessions similar to the "Combined Services" cookbook example.

3. Create it from a base POE and create the POE::Sessions myself (instead of using the POE::Component::IRC) to handle all the IRC events and second POE::Sessions to handle the web app query.

By going with #1 it will save me a lot of time in handling the IRC events, reconnection, etc. But being a noob with POE, I'm wondering if there's some potential problem I'd run into.

Or is there a better way aside from what I'm thinking?

Thanks in advance.

Celso

Chris Prather

unread,
Feb 7, 2014, 6:20:12 PM2/7/14
to Celso Barriga, p...@perl.org

Unless I'm misunderstanding there really isn't a huge differentiation between your choices here except in "how much work I expect to write myself".

I'd start with option 1 since that involves the least amount of work for you personally, and is nearly a proper subset of the others. Then if you run into problems you can escalate to a more complicated solution.

-Chris

Evan Carroll

unread,
Feb 12, 2014, 1:50:32 AM2/12/14
to Celso Barriga, p...@perl.org
Download and install Buubot,

https://github.com/simcop2387/buubot

review the code base and add the plugin that does what you want.

--
Evan Carroll - m...@evancarroll.com
System Lord of the Internets
web: http://www.evancarroll.com
ph: 281.901.0011

Celso Barriga

unread,
Feb 12, 2014, 4:34:44 PM2/12/14
to p...@perl.org
Thank you!

I'm using PoCo::IRC and the basic gut of my app is currently working. It's already very feature rich with just about 300 lines of code.

POE Rocks!
0 new messages