The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Beam::Event - Base Event class

VERSION

version 1.001

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 "on" in Beam::Emitter.

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 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 the emit method, 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".

SEE ALSO

Beam::Emitter

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

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.