object_states 3
by Lanas other posts by this author
Nov 20 2006 5:30AM messages near this date
Re: [Dbix-class] POE::Component::DBD::MySQL
|
Re: object_states 3
Folks,
Re.: choosing which method amongst objects having same method names.
The technique described in POE::Session seems to fulfill this goal but
moreover, it enables some kind of an easy double-dispatch of both object
and method since Perl is reflective:
my $obj_a = osObj1-> new();
my $obj_b = osObj2-> new();
POE::Session-> create
(
object_states =>
[
$obj_a => {method1_obja => 'method1',
method2_obja => 'method2',
},
$obj_b => {method1_objb => 'method1',
method2_objb => 'method2',
},
],
inline_states =>
{
_start => \&startIt,
},
);
sub startIt
{
print "Started !\n";
$_[KERNEL]-> alias_set("os");
my $methodNumber = 2;
my $objName = 'a';
$_[KERNEL]-> post('os', "method$methodNumber\_obj$objName");
}
Any comments on the subject are welcomed.
Cheers,
Al
Thread:
Lanas
Rocco Caputo
|