On 5/6/07, Kidney Bingos <[EMAIL PROTECTED]> wrote:

One other 'trick' is that the heap can be any type of scalar, so one can use 
whatever
one likes as the heap, such as an arrayref, hashref and even a blessed 
reference such
as an object.

PoCo-IRC for instance has the component's object as it's heap.


One advantage of this trick is getting at the object, and thus both
the data and the methods, though the session->get_heap(). Since all
states get passed the SENDER session reference, one can use
$_[SENDER]->get_heap() to get the calling object if one stores it as
the session heap.

One could just send the object as one of the ARGS, but there are times
when that is not elegant or perhaps even practical when dealing with
existing code.

I don't recall seeing a recipe that illustrated this, but perhaps I
just hadn't grokked POE well enough when I read that recipe. I didn't
realize this power until about two weeks ago, when it solved a problem
I was having rather cleanly.

Regards,
--
Eric Hacker, CISSP

aptronym (AP-troh-NIM) noun
A name that is especially suited to the profession of its owner

I _can_ leave well enough alone, but my criteria for well enough is
pretty darn high.

Reply via email to