|
NAMEPOE::Session::MultiDispatch - Callback dispatch for session events.SYNOPSISuse POE qw[Session::MultiDispatch]; my $session = POE::Session::MultiDispatch->create( inline_states => { _start => \&_start }, package_states => [ ... ], object_states => [ ... ], ); sub _start { # Execute Foo::Bar's _start state first. $_[SESSION]->first( _start => 'Foo::Bar' ); $_[SESSION]->stop; } # run Foo::Bar's done state last. $session->last( done => 'Foo::Bar' ); $poe_kernel->run; exit 0; DESCRIPTIONPOE::Session::MultiDispatch is a drop in replacement for POE::Session that adds callback dispatch functionality to POE sessions. Each event may have multiple handlers associated with it. Fine control over the order of execution is available using helper methods that extend the interface of a POE::Session.POE::Session::MultiDispatch uses POE::Session as a base class. When multiple callbacks are registered for an event, only the last callback survives, all the others are clobbered. POE::Session::MultiDispatch is much nicer to your registered callbacks, it keeps them all in the order they were defined. When an event is triggered, all the callbacks are then executed in that same order (unless you muck around with said order). Just what is the order? Last I checked it is "inline_states", "package_states", and "object_states". As you can probably tell, that order is by no means documented (here or anywhere else) as something that is stead fast and solid. You should be careful and know what you're doing if you intend to care too much about the order. Having said that, my guess is that it won't change. But don't take my word for it. All the real heavy lifting is still done in POE::Session. The interface is exactly the same with the exception of the following additions. Please read the POE::Session documentation for details on working with POE sessions. MethodsThese methods have been added to POE::Sessions's interface. They can be accessed from an event by using the session object stored in $_[SESSION]. Alternativley, you can use the object returned when calling "create()" to call these methods.
BUGSNo doubt.See http://rt.cpan.org to report bugs. Known IssuesThe following is what I would consider known issues.
AUTHORCasey West <casey@geeknest.com>THANKSMatt Cashner -- Many features inspired by his earlier modle, POE::Session::Cascading.COPYRIGHTCopyright (c) 2003 Casey West. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.SEE ALSOperl, POE::Session, POE.
Visit the GSP FreeBSD Man Page Interface. |