Skip to content

reneeb/MojoX-GlobalEvents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Kwalitee status GitHub issues

NAME

MojoX::GlobalEvents - A module to handle events

VERSION

version 0.06

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

Development

The distribution is contained in a Git repository, so simply clone the repository

$ git clone http://github.com/reneeb/MojoX-GlobalEvents.git

and change into the newly-created directory.

$ cd MojoX-GlobalEvents

The project uses Dist::Zilla to build the distribution, hence this will need to be installed before continuing:

$ cpanm Dist::Zilla

To install the required prequisite packages, run the following set of commands:

$ dzil authordeps --missing | cpanm
$ dzil listdeps --author --missing | cpanm

The distribution can be tested like so:

$ dzil test

To run the full set of tests (including author and release-process tests), add the --author and --release options:

$ dzil test --author --release

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)

About

Another "event system" for Mojo applications

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages