Mojo::Events - Dispatch and handle sync/async events in Mojolicious
use Mojo::Events; my $events = Mojo::Events->new(app => $app, namespaces => ['Listeners::Namespace']); $events->dispatcher->dispatch(say => 'Hello!');
Mojo::Events is a very basic implementation for events/listeners
Mojo::Events inherits all attributes from Mojo::Base.
Mojo::Events inherits all methods from Mojo::Base and implements the following new ones.
my $events = Mojo::Events->new(app => $app, namespaces => ['Listeners::Namespace']);
Events manipulator object.
my $dispatcher = $events->dispatcher; # dispatch an event $dispatcher->dispatch(event_name => (<event args>)); # register a new listener $dispatcher->register(My::Custom::Listener->new(app => $mojolicious));
Events dispatcher.
Mojolicious, Mojolicious::Guides, https://mojolicious.org.
To install Mojo::Events, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Events
CPAN shell
perl -MCPAN -e shell install Mojo::Events
For more information on module installation, please visit the detailed CPAN module installation guide.