POE::Session::MultiDispatch

Callback dispatch for session events
Download

POE::Session::MultiDispatch Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Casey West
  • Publisher web site:
  • http://search.cpan.org/~cwest/

POE::Session::MultiDispatch Tags


POE::Session::MultiDispatch Description

Callback dispatch for session events The POE::Session::MultiDispatch module 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.SYNOPSIS use POE qw; my $session = POE::Session::MultiDispatch->create( inline_states => { _start => &_start }, package_states => , object_states => , ); sub _start { # Execute Foo::Bar's _start state first. $_->first( _start => 'Foo::Bar' ); $_->stop; } # run Foo::Bar's done state last. $session->last( done => 'Foo::Bar' ); $poe_kernel->run; exit 0; Requirements: · Perl


POE::Session::MultiDispatch Related Software