Hello,

I am using POE for a little Data Server, It receives input from the client
(in the form of a multiline query) and returns a result.

The structure of my project is as follows:

UT::Shell;
This is the highest level object and gets the initial socketfactory up and
running.

UT::Session;
This creates a POE::Session and POE::Wheel::ReadWrite, based on the creation
parameters UT::Shell gives it.

UT::Event;
This is the generic event object, designed for handling the key/value paired
input from the user. It is inherited by the UT::Event::<type> objects. It
triggers start() and finish() in UT::Event::<type>. (More about this later.)


UT::Event::<type>
This object inherits the methods of UT::Event. This object has 2 primary
methods; start() and finish().  start() is called when UT::Session receives
a new query.  finish() is called when UT::Event determines the query has
completed.

The input queries are in a format like this:

<EVENT TYPE>
KEY:  Value
KEY:  Value
...and so on
<END>

When a client connects to the socketfactory, I create a new object called
'UT::Session' and pass the $socket on to it.  UT::Session then creates a new
POE::Session and POE::Wheel::ReadWrite.

The first line of the client input dictates what kind of event we have, then
UT::Session creates a new UT::Event::<type> object.  The UT::Event::<type>
inherits the generic UT::Event object.

When <END> is reached the UT::Event destroys it's self and the UT::Session
then waits for the next query.  (When the UT::Session is 'in progress' the
POE 'receive' state is mapped to a sub that sends the data on to the
UT::Event::<type>.  When the session is begun or complete the POE 'receive'
state is handled by the UT::Session.)

This process is in effect, sort of a sustained connection, so multiple
queries can be performed in a single UT::Session.

Now, I have some problems with this.  First of all it seems a bit to much
like a 'jungle of objects'.  Below are my specific questions.

I am not sure when I should tell perl to 'use UT::Event::<type>;' (In
UT::Session?).  The point of making these things objects was to reduce the
size of UT::Session.

I do not know of a nice way to allow the UT::Event::<type> objects to use
the POE alarms and delays.

I am not sure if this is even the right approach to use in conjunction with
POE.

Well, I am not sure how clear I've made all this, but I hope you all can be
of some assistance.

Jotham.

(Dear god, the spell checker tried to get me to call it Purl)


-------------------------------------- 
Internet E-mail Confidentiality Footer 
Privileged/Confidential Information may be contained in this message. 
If you are not the addressee indicated in this message (or responsible for 
delivery of the message to such person), you may not copy or deliver this 
message to anyone. 
In such case, you should destroy this message and kindly notify the sender 
by reply email. Please advise immediately if you or your employer do not 
consent to Internet email for messages of this kind. 
Opinions, conclusions and other information in this message that do not 
relate to the official business of my firm shall be understood as neither 
given nor endorsed by it. 
-------------------------------------- 


Reply via email to