Beam::Event - Base Event class
version 1.001
# My::Emitter consumes the Beam::Emitter role my $emitter = My::Emitter->new; $emitter->on( "foo", sub { my ( $event ) = @_; print "Foo happened!\n"; # stop this event from continuing $event->stop; } ); my $event = $emitter->emit( "foo" );
This is the base event class for Beam::Emitter objects.
Beam::Emitter
The base class is only really useful for notifications. Create a subclass to add data attributes.
The name of the event. This is the string that is given to "on" in Beam::Emitter.
The emitter of this event. This is the object that created the event.
This is true if anyone called "stop_default" on this event.
Your emitter should check this attribute before trying to do what the event was notifying about.
This is true if anyone called "stop" on this event.
When using the emit method, this is checked automatically after every callback, and event processing is stopped if this is true.
Calling this will cause the default behavior of this event to be stopped.
NOTE: Your event-emitting object must check "is_default_stopped" for this behavior to work.
Calling this will immediately stop any further processing of this event. Also calls "stop_default".
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2015 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Beam::Emitter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beam::Emitter
CPAN shell
perl -MCPAN -e shell install Beam::Emitter
For more information on module installation, please visit the detailed CPAN module installation guide.