MojoX::GlobalEvents - A module to handle events
version 0.06
Initialize the module once:
use MojoX::GlobalEvents; # load all event listeners located in "Name::Space" MojoX::GlobalEvents->init( 'Name::Space' );
In any Perl module:
use MojoX::GlobalEvents; publish event_name => $param1, $param2;
In your event handler modules;
use MojoX::GlobalEvents; on event_name => sub { print "received event event_name\n"; };
or subscribe with a single object
package Cat; use Mojo::Base '-base'; use MojoX::GlobalEvents; has eyes => 2; package main; my $cat = Cat->new; $cat->on( 'sunset' => sub { print "even when it's dark I can see with my " . shift->eyes . " eyes\n"; }); publish 'sunset';
Renee Baecker <reneeb@cpan.org>
This software is Copyright (c) 2014 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install MojoX::GlobalEvents, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MojoX::GlobalEvents
CPAN shell
perl -MCPAN -e shell install MojoX::GlobalEvents
For more information on module installation, please visit the detailed CPAN module installation guide.