Rebecca Turner > MooseX-Event > MooseX::Event::Role

Download:
MooseX-Event-v0.2.0.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: v0.2.0   Source   Latest Release: MooseX-Event-0.3.0_2

NAME ^

MooseX::Event::Role - A Node style event Role for Moose

VERSION ^

version v0.2.0

DESCRIPTION ^

This is the role that MooseX::Event extends your class with. All classes using MooseX::Event will have these methods, attributes and events.

EVENTS ^

new_listener( Str $event, CodeRef $listener )

Called when a listener is added. $event is the name of the event being listened to, and $listener is the listener being installed.

ATTRIBUTES ^

our Str $.current_event is rw

This is the name of the current event being triggered, or undef if no event is being triggered.

METHODS ^

our method event_exists( Str $event ) returns Bool

Returns true if $event is a valid event name for this class.

our method on( Str $event, CodeRef $listener ) returns CodeRef

Registers $listener as a listener on $event. When $event is emitted ALL registered listeners are executed.

Returns the listener coderef.

our method once( Str $event, CodeRef $listener ) returns CodeRef

Registers $listener as a listener on $event. Event listeners registered via once will emit only once.

Returns the listener coderef.

our method emit( Str $event, Array[Any] *@args )

Normally called within the class using the MooseX::Event role. This calls all of the registered listeners on $event with @args.

If you're using coroutines then each listener will get its own thread and emit will cede before returning.

our method remove_all_listeners( Str $event )

Removes all listeners for $event

our method remove_listener( Str $event, CodeRef $listener )

Removes $listener from $event

SEE ALSO ^

Please see those modules/websites for more information related to this module.

AUTHOR ^

Rebecca Turner <becca@referencethis.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2011 by Rebecca Turner.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTY ^

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

syntax highlighting: