Regarding using a blessed reference as the heap...
I looked at the PoCo-IRC source as well as this thread, but I not quite
getting it.
My PoCo has a spawn like this:
sub spawn {
my $package = shift;
my %opts = @_;
$opts{lc $_} = delete $opts{$_} for keys %opts;
my $self = bless \%opts, $package;
$self->{session_id} = POE::Session->create (
object_states => [
$self => { _start => '_start',
_stop => '_stop',
series => 'series',
refresh => 'refresh',
refresh_rate => 'refresh_rate',
reset => 'reset',
proxy => 'proxy',
tell_me_about_car_at_pos => 'car_info',
},
],
)->ID();
return $self;
}
My _start/init populates $self. For example:
$self->{top_speeds} = {};
This PoCo instantiates a bunch of plain old objects (type Car). These
objects are stored off the PoCo in a hash like so:
$self->{_cars}->{$car_num} = Car->new( Kernel => $kernel, );
I am passing these objects the KERNEL so that they can fire off events
(maybe there is a better way to do this.
From one of these Car objects, I want to access the PoCo's {top_speeds}
structure. This doesn't appear to do it:
$heap = $self->{kernel}->get_active_session->get_heap();
$self->{kernel} is what was passed in the Car->new call above. What
appears to happen is that it is accessing the heap, and not the object's
data like I would expect from my limited understanding. I presume I am
not instantiating the PoCo in the way of the 'trick'.
Where should I look?
Thanks,
John