logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

object_states 2: msg#00019

Subject: object_states 2
Hi again,

  Is there a way to choose the obj as well as the method ?  The example
below will call method2() of whatever object was declared last in the
object_states list (or so it seems), when several different objects have
same method names:

my $obj_a = osObj1->new();
my $obj_b = osObj2->new();

POE::Session->create
  (
   object_states =>
    [
     $obj_a => ['method1', 'method2'],
     $obj_b => ['method1', 'method2'],
    ],

    inline_states =>
    {
     _start => \&startIt,
    },
  );

sub startIt
{
  print "Started !\n";
  $_[KERNEL]->alias_set("os");
  $_[KERNEL]->post('os', 'method2');
}

method2() of obj_b gets called.  How to specify obj_a ?

Cheers,
Al




<Prev in Thread] Current Thread [Next in Thread>