NAME
Beam::Event - Base Event class
VERSION
version 0.003
SYNOPSIS
# 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" );
DESCRIPTION
This is the base event class for Beam::Emitter
objects.
The base class is only really useful for notifications. Create a subclass to add data attributes.
ATTRIBUTES
name
The name of the event. This is the string that is given to Beam::Emitter::on
.
emitter
The emitter of this event. This is the object that created the event.
is_default_stopped
This is true if anyone called "stop_default" on this event.
Your Beam::Emitter should check this attribute before trying to do what the event was notifying about.
is_stopped
This is true if anyone called "stop" on this event.
When using Beam::Emitter/emit, this is checked automatically after every callback, and event processing is stopped if this is true.
METHODS
stop_default ()
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.
stop ()
Calling this will immediately stop any further processing of this event. Also calls "stop_default".
AUTHOR
Doug Bell <preaction@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 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.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 105:
alternative text 'Beam::Emitter/emit' contains non-escaped | or /