On Mon, Dec 10, 2001 at 02:05:11PM +0100, Jotham Read wrote:
> Hello,

[...]

> 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.

Knowing only this about your project, I would use UT::Event::<type>
after UT::Session determined the type the client was requesting.  To
get "use" working at runtime, I'd either string eval it or block eval
a require and import.

Making UT::Session data driven may help, but I don't know enough about
it to say for sure.

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

Would they need their own alarms and delays, or do you plan to set
them in the UT::Session instance that created them?  I can suggest two
solutions to the former problem:

1. Have each UT::Session hold its own internal POE::Session for
   private timers.

2. Create a "service" component that holds timers on behalf of
   UT::Event instances.  The service would deliver timers with plain
   callbacks.

As for the latter, you can use $poe_kernel (exported by POE::Kernel)
to access alarm() and delay() for the parent POE::Session.

  sub some_library_function {
    $poe_kernel->delay( event_for_calling_session => 60 );
  }

[...]

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net

Reply via email to