Re: POE Newbie chasing anothers code
Mark Swayne <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
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