NAME

MojoX::GlobalEvents - A module to handle events

VERSION

version 0.04

SYNOPSIS

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';

FUNCTIONS

init

on

publish

AUTHOR

Renee Baecker <reneeb@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2014 by Renee Baecker.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)