ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-poe
perl-poe
Re: object_states 3
by Rocco Caputo other posts by this author
Nov 20 2006 8:26AM messages near this date
object_states 3 | make test errors
Unless I'm overlooking a detail in your code, this looks legal.

--  
Rocco Caputo - rcaputo@[...].com

On Nov 18, 2006, at 22:25, lanas wrote:

>  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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved