in reply to Re: POE::IRC, Where was that tall building again?
in thread POE::IRC, Where was that tall building again?

I didn't know that I was being so unclear.

I understand the basics of whats going on. I've even processed what I want in the irc_352 event. The question is how can I pass that back to where $irc->yield( who => '#poe') was called. I could use globals but there has to be some manageable way to pass around the results of each event. Thats more or less what I'm asking.

I'm looking to translate my @results = $irc->yield (who => '#poe'); into the POE realm if its even possible.

Replies are listed 'Best First'.
Re^3: POE::IRC, Where was that tall building again?
by Fletch (Bishop) on Jul 16, 2008 at 15:52 UTC

    That's the thing: there isn't anything inside of POE itself to tie any random pair of events together. It's not that you're unclear; more that I'm explaining it poorly and it requires you to have an "Aha!" moment and get your head thinking the POE-y state machine way. Let's try this:

    Your sessions are what's responsible for maintaining state (most cleanly through declaring object_states which will be called as methods on an instance; see Using POE::Session With Objects; alternately you can stash things in the session's private $_[HEAP] if you don't want to make a separate class). Your session instances maintain any context or state information (maybe by doing push @{$self->{pending_who_requests}}, $channel) and then alter their state accordingly as events warrant (removing an entry from that pending list and firing off an event back to the requesting session (or the same session) with the processed who information when it receives the reply event to a given request).

    Update: Added mention of $_[HEAP] to parenthetical.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.