Re: Need advice on a new POE project
"Chris Prather" <[email protected]> Fri, 07 Feb 2014 15:20:12 -0800 (PST)
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <1391815211533.c70241bf@Nodemailer> |
------Nodemailer-0.5.0-?=_1-1391815212243 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Unless I'm misunderstanding there really isn't a huge differentiation = between your choices here except in =22how much work I expect to write = myself=22. 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 On Fri, Feb 7, 2014 at 5:54 PM, Celso Barriga <[email protected]> wrote: > 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=3F) 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 =22mission critical=22 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 =22Combined Services=22 = 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=3F > Thanks in advance. > Celso ------Nodemailer-0.5.0-?=_1-1391815212243 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <span id=3D=22mailbox-conversation=22><br><div>Unless I'm misunderstanding = there really isn't a huge differentiation between your choices here except = in =22how much work I expect to write myself=22.</div> <div><br></div> <div>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.= </div> <div><br></div> <div>-Chris</div></span><br><br><div class=3D=22gmail=5Fquote=22><p>On Fri,= Feb 7, 2014 at 5:54 PM, Celso Barriga <span dir=3D=22ltr=22><<a = href=3D=22mailto:[email protected]=22 target=3D=22=5Fblank=22>cbarriga@gma= il.com</a>></span> wrote:<br></p><blockquote class=3D=22gmail=5Fquote=22= style=3D=22margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;= =22><div dir=3D=22ltr=22>Hello!<div><br></div> <div>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.</div> <div><br></div> <div>In a nutshell, here's what my program is supposed to do:</div> <div><br></div> <div>0. Log in to an IRC server, at a specified channel.</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'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=3F) and go back to #1= .</div> <div><br></div> <div>The data is retrieved through some filter, so there's not going to be = a lot of data that will come back.</div> <div><br></div> <div>The program has to be =22mission critical=22 as much as possible, that= is, it has to rejoin the channel if kicked out, or reconnect to the server= if disconnected.</div> <div><br></div> <div>Here are some of my ideas how I'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'm going to = use the recurring alarm cookbook example in case this will take a while.= </div> <div><br></div> <div>2. Create two separate sessions similar to the =22Combined Services=22= cookbook example.</div> <div><br></div> <div>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.</div> <div><br></div> <div>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.</div> <div> <br></div> <div>Or is there a better way aside from what I'm thinking=3F</div> <div><br></div> <div>Thanks in advance.</div> <div><br></div> <div>Celso</div> <div><br></div> </div></blockquote></div><br> ------Nodemailer-0.5.0-?=_1-1391815212243--