On Mon, Mar 01, 2004 at 08:43:36PM -0600, Jay Strauss wrote:
> Hi,
> 
> I feel like I'm doing something wrong, but I don't see any other way to do
> this.  I want to have an object that contains POE.  When I new the object I
> have to save self in HEAP so that I can access the $self attributes from the
> inlineStates.  I'm doing it like:
> 
> sub new {
>     my $class = shift;
>     $self = {};
> 
>     # stick some stuff in $self from @_
> 
>     POE::Component::Client::TCP->new(
>     ....
>     Args           => [$self],
>     Started        => sub {$_[HEAP]->{self} = $_[ARG0]},
>     ...
> }
> 
> It just seems kinda awkward/weird

If you use object_states instead, the handlers will be passed
$_[OBJECT], which corresponds to $self.

-- 
Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/

Reply via email to