line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Beam::Event; |
2
|
|
|
|
|
|
|
our $VERSION = '1.005'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Base Event class |
4
|
|
|
|
|
|
|
|
5
|
10
|
|
|
10
|
|
2299
|
use strict; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
333
|
|
6
|
10
|
|
|
10
|
|
45
|
use warnings; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
387
|
|
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
2883
|
use Moo; |
|
10
|
|
|
|
|
48937
|
|
|
10
|
|
|
|
|
96
|
|
9
|
10
|
|
|
10
|
|
8909
|
use Types::Standard qw(:all); |
|
10
|
|
|
|
|
125049
|
|
|
10
|
|
|
|
|
126
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#pod =attr name |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod The name of the event. This is the string that is given to L. |
14
|
|
|
|
|
|
|
#pod |
15
|
|
|
|
|
|
|
#pod =cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has name => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
isa => Str, |
20
|
|
|
|
|
|
|
required => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#pod =attr emitter |
24
|
|
|
|
|
|
|
#pod |
25
|
|
|
|
|
|
|
#pod The emitter of this event. This is the object that created the event. |
26
|
|
|
|
|
|
|
#pod |
27
|
|
|
|
|
|
|
#pod =cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has emitter => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
isa => ConsumerOf['Beam::Emitter'], |
32
|
|
|
|
|
|
|
required => 1, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#pod =attr is_default_stopped |
36
|
|
|
|
|
|
|
#pod |
37
|
|
|
|
|
|
|
#pod This is true if anyone called L on this event. |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod Your L should check this attribute before trying to do |
40
|
|
|
|
|
|
|
#pod what the event was notifying about. |
41
|
|
|
|
|
|
|
#pod |
42
|
|
|
|
|
|
|
#pod =cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has is_default_stopped => ( |
45
|
|
|
|
|
|
|
is => 'rw', |
46
|
|
|
|
|
|
|
isa => Bool, |
47
|
|
|
|
|
|
|
default => sub { 0 }, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#pod =attr is_stopped |
51
|
|
|
|
|
|
|
#pod |
52
|
|
|
|
|
|
|
#pod This is true if anyone called L on this event. |
53
|
|
|
|
|
|
|
#pod |
54
|
|
|
|
|
|
|
#pod When using L, this is checked automatically |
55
|
|
|
|
|
|
|
#pod after every callback, and event processing is stopped if this is true. |
56
|
|
|
|
|
|
|
#pod |
57
|
|
|
|
|
|
|
#pod =cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has is_stopped => ( |
60
|
|
|
|
|
|
|
is => 'rw', |
61
|
|
|
|
|
|
|
isa => Bool, |
62
|
|
|
|
|
|
|
default => sub { 0 }, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#pod =method stop_default () |
66
|
|
|
|
|
|
|
#pod |
67
|
|
|
|
|
|
|
#pod Calling this will cause the default behavior of this event to be stopped. |
68
|
|
|
|
|
|
|
#pod |
69
|
|
|
|
|
|
|
#pod B Your event-emitting object must check L for this |
70
|
|
|
|
|
|
|
#pod behavior to work. |
71
|
|
|
|
|
|
|
#pod |
72
|
|
|
|
|
|
|
#pod =cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub stop_default { |
75
|
3
|
|
|
3
|
1
|
804
|
my ( $self ) = @_; |
76
|
3
|
|
|
|
|
73
|
$self->is_default_stopped( 1 ); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#pod =method stop () |
80
|
|
|
|
|
|
|
#pod |
81
|
|
|
|
|
|
|
#pod Calling this will immediately stop any further processing of this event. |
82
|
|
|
|
|
|
|
#pod Also calls L. |
83
|
|
|
|
|
|
|
#pod |
84
|
|
|
|
|
|
|
#pod =cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub stop { |
87
|
2
|
|
|
2
|
1
|
876
|
my ( $self ) = @_; |
88
|
2
|
|
|
|
|
11
|
$self->stop_default; |
89
|
2
|
|
|
|
|
78
|
$self->is_stopped( 1 ); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__END__ |