[tpm] Event loop, redux

Alex Beamish talexb at gmail.com
Fri Jun 13 07:32:30 PDT 2008


On Fri, Jun 13, 2008 at 9:05 AM, David Golden <xdaveg at gmail.com> wrote:
> On Fri, Jun 13, 2008 at 8:54 AM, Madison Kelly <linux at alteeve.com> wrote:
>>   A while ago I was asking about event loops. Richard and Mike
>> recommended I look at POE, and well, as Alan put it, it's an OS written
>> in Perl.
>>
>>   Very impressive, but very overkill for my needs. :)
>>
>>   I've got a simple server program that listens for TCP connections
>> from clients which, on connect, spawns a child process to handle the
>> client. Already I can talk between the client and the server to
>> establish a connection (password verification), but then I am stumped,
>> so I close the connection.
>
> I haven't jumped into POE myself, but in trying to decide if/when I
> should, I did find this tutorial:
>
> http://poe.perl.org/?Evolution_of_a_POE_Server
>
> It shows a simple TCP server -- written the hard way.  Then it
> gradually swaps out pieces of it with POE components using greater and
> greater levels of abstraction until the final program is quite small
> and elegant.  It's both a good tutorial and a good argument for why to
> use POE.
>
> I think it will help you regardless of whether you ultimately choose
> to use POE or not.

Just to echo David's comments, while POE may seem to be overkill, it
will probably do exactly what you want.

I haven't used POE myself, but I have been hearing about it on and off
for some time (YAPC 2001? Is that possible?). I'll give you another
example: recently at $work, I wanted to be able to include a
configuration file into a web page (it's an applet tag for a Java
application), and fail gracefully if the config file was absent.

I could have written all kinds of complicated code to take care of
that, but Template Tookit was available, so I just added a TRY INCLUDE
CATCH END lump of code in the template that I created, and I was done
-- and it works fine. TT is a vast piece of code just to get that
little piece of functionality, but it sure saved me from re-inventing
the wheel, and I have a solution that I have lots of confidence in.

-- 
Alex Beamish
Toronto, Ontario
aka talexb


More information about the toronto-pm mailing list