| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mixin::Event::Dispatch::Methods; |
|
2
|
|
|
|
|
|
|
$Mixin::Event::Dispatch::Methods::VERSION = '2.000'; |
|
3
|
3
|
|
|
3
|
|
96386
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
68
|
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
74
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1832
|
use parent qw(Exporter); |
|
|
3
|
|
|
|
|
779
|
|
|
|
3
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Mixin::Event::Dispatch::Methods - importer class for applying L methods without inheritance |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
version 2.000 |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Role::WithEvents; |
|
19
|
|
|
|
|
|
|
use Moo::Role; |
|
20
|
|
|
|
|
|
|
use Mixin::Event::Dispatch::Methods qw(:all); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Some::Class; |
|
23
|
|
|
|
|
|
|
use Moo; |
|
24
|
|
|
|
|
|
|
with 'Role::WithEvents'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Provides the following L tags: |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 :all |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Imports all known methods. Probably a good default if this is being applied to |
|
33
|
|
|
|
|
|
|
a specific role class. The methods imported may change in future, use :v2 if |
|
34
|
|
|
|
|
|
|
you want to limit to a specific list that will never change. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 :v2 |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Supports the methods provided by the 2.000 API. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over 4 |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item * L |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item * L |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item * L |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item * L |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item * L |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=item * L |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=back |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 :basic |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Imports only the bare minimum methods for subscribing/unsubscribing. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * L |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * L |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * L |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * L |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
|
73
|
|
|
|
|
|
|
|
|
74
|
3
|
|
|
3
|
|
1631
|
use Mixin::Event::Dispatch; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
232
|
|
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my @functions = qw( |
|
77
|
|
|
|
|
|
|
invoke_event |
|
78
|
|
|
|
|
|
|
subscribe_to_event |
|
79
|
|
|
|
|
|
|
unsubscribe_from_event |
|
80
|
|
|
|
|
|
|
add_handler_for_event |
|
81
|
|
|
|
|
|
|
event_handlers |
|
82
|
|
|
|
|
|
|
clear_event_handlers |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
our @EXPORT; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
our @EXPORT_OK = @functions; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
|
90
|
|
|
|
|
|
|
all => [ @functions ], |
|
91
|
|
|
|
|
|
|
v2 => [ @functions ], |
|
92
|
|
|
|
|
|
|
basic => [ qw(invoke_event subscribe_to_event unsubscribe_from_event event_handlers) ], |
|
93
|
|
|
|
|
|
|
); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
{ |
|
96
|
3
|
|
|
3
|
|
14
|
no strict 'refs'; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
155
|
|
|
97
|
|
|
|
|
|
|
*$_ = *{'Mixin::Event::Dispatch::' . $_ } for @functions; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Tom Molesworth |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 LICENSE |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Copyright Tom Molesworth 2011-2015, based on code originally part of L. |
|
109
|
|
|
|
|
|
|
Licensed under the same terms as Perl itself. |