Need advice on a new POE project

Celso Barriga <[email protected]> Fri, 7 Feb 2014 17:53:56 -0500
Newsgroups gmane.comp.lang.perl.poe
Message-ID <CAEijLJnWtsA1STSAd57hOR18XfFGUodduN0x7cFvZ9KjXQoCrA@mail.gmail.com>
--001a1137087c6625ac04f1d8ddfe
Content-Type: text/plain; charset=ISO-8859-1

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

--001a1137087c6625ac04f1d8ddfe
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello!<div><br></div><div>I just discovered POE while rese=
arching on a project I&#39;m about to embark on at work. So I&#39;m new wit=
h POE, but a long time Perl programmer. I&#39;ve read through most of the d=
ocumentation and tutorial, and now I&#39;m trying to decide what approach t=
o take.</div>
<div><br></div><div>In a nutshell, here&#39;s what my program is supposed t=
o do:</div><div><br></div><div>0. Log in to an IRC server, at a specified c=
hannel.</div><div><br></div><div>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&#39;t have to make the REST calls directly. This perl module=
 is using LWP.</div>
<div><br></div><div>2. For each of the data returned from #1, post it to an=
 IRC channel.</div><div><br></div><div>3. Wait for some predetermined time =
(say 60 secs?) and go back to #1.</div><div><br></div><div>The data is retr=
ieved through some filter, so there&#39;s not going to be a lot of data tha=
t will come back.</div>
<div><br></div><div>The program has to be &quot;mission critical&quot; as m=
uch as possible, that is, it has to rejoin the channel if kicked out, or re=
connect to the server if disconnected.</div><div><br></div><div>Here are so=
me of my ideas how I&#39;m going to do it, in order of preference:</div>
<div><br></div><div>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&#=
39;m going to use the recurring alarm cookbook example in case this will ta=
ke a while.</div>
<div><br></div><div>2. Create two separate sessions similar to the &quot;Co=
mbined Services&quot; cookbook example.</div><div><br></div><div>3. Create =
it from a base POE and create the POE::Sessions myself (instead of using th=
e POE::Component::IRC) to handle all the IRC events and second POE::Session=
s to handle the web app query.</div>
<div><br></div><div>By going with #1 it will save me a lot of time in handl=
ing the IRC events, reconnection, etc. But being a noob with POE, I&#39;m w=
ondering if there&#39;s some potential problem I&#39;d run into.</div><div>
<br></div><div>Or is there a better way aside from what I&#39;m thinking?</=
div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Celso</=
div><div><br></div></div>

--001a1137087c6625ac04f1d8ddfe--