Re: POE Newbie chasing anothers code

Rocco Caputo <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
Class methods work by lucky chance rather than deliberate design.   
Calling POE::Kernel by class may not work for all methods, and it may  
not work in the future.  There's no plan to change this, but it may be  
a side effect of some (also unplanned) future feature.  Or it may  
become officially supported, in which case you'll see it in the docs.

The $poe_kernel export (or $POE::Kernel::poe_kernel) is mainly for  
libraries that may not get POE::Session's usual callback parameters.

-- 
Rocco Caputo - [email protected]


On Jun 25, 2009, at 22:38, Mark Swayne wrote:

> Bruce Ferrell wrote:
>> is there a difference between:
>>
>> POE::Kernel->post()
>>
>> and
>>
>> $poe_kernel->post()
>>
>>
> Bruce,
>
> In case you haven't found it yet, they are (basically) the same.
>
> $poe_kernel is exported by POE::Kernel.  It's a reference to the  
> Kernel singleton.
> Calling $poe_kernel->post, calls the post method on the $poe_kernel  
> object.  While POE::Kernel->post, is using a hard coded class name.
> The only place I'd expect a difference, is if you start working with  
> a subclass of POE::Kernel that overrides the post method.  Then all  
> your POE::Kernel calls will create chaos.  (Or maybe if a future  
> version of post breaks without an object reference, like ID).
>
> The examples for post use $_[KERNEL] to access the kernel object.
>
> Out of distrust for exported globals, I'd do as in the docs, and use  
> $_[KERNEL].
>
> http://search.cpan.org/dist/POE/lib/POE/Kernel.pm#$poe_kernel
> http://search.cpan.org/dist/POE/lib/POE/Kernel.pm#post_DESTINATION,_EVENT_NAME_ 
> [,_PARAMETER_LIST]
>
> --Mark Swayne
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.