line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Reflex::Callback; |
2
|
|
|
|
|
|
|
# vim: ts=2 sw=2 noexpandtab |
3
|
|
|
|
|
|
|
$Reflex::Callback::VERSION = '0.100'; |
4
|
13
|
|
|
13
|
|
55
|
use Moose; |
|
13
|
|
|
|
|
16
|
|
|
13
|
|
|
|
|
99
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# It's a class if it's a Str. |
7
|
|
|
|
|
|
|
has object => ( |
8
|
|
|
|
|
|
|
is => 'rw', |
9
|
|
|
|
|
|
|
isa => 'Object|Str', |
10
|
|
|
|
|
|
|
weak_ref => 1, |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
1; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__END__ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=pod |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=encoding UTF-8 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=for :stopwords Rocco Caputo |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Reflex::Callback - Generic callback adapters to simplify calling back |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This document describes version 0.100, released on April 02, 2017. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Varies. See individual Reflex::Callback subclasses. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 DESCRIPTION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Reflex::Callback and its subclasses implement the different types of |
40
|
|
|
|
|
|
|
calbacks that Reflex supports. Reflex::Callbacks provides convenience |
41
|
|
|
|
|
|
|
functions that are almost always used instead of Reflex::Callback |
42
|
|
|
|
|
|
|
objects. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Reflex::Callback's generic interface is a constructor and a single |
45
|
|
|
|
|
|
|
method, deliver(), which routes its parameters to their destination. |
46
|
|
|
|
|
|
|
Subclasses may implement additional methods to support specific use |
47
|
|
|
|
|
|
|
cases. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 new |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Constructor parameters vary from one subclass to another. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 deliver |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
All deliver() methods take two positional parameters: the name of an |
56
|
|
|
|
|
|
|
event being delivered, and a hashref of named parameters for the |
57
|
|
|
|
|
|
|
callback. Not all subclasses actually use the event name, however. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=for Pod::Coverage deliver make_emitter make_error_handler make_null_handler make_terminal_emitter |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 SEE ALSO |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Please see those modules/websites for more information related to this module. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=over 4 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
L<Reflex|Reflex> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
L<Reflex> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
L<Reflex::Callback::CodeRef> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L<Reflex::Callback::Method> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
L<Reflex::Callback::Promise> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
L<L<Reflex::Callbacks> documents callback convenience functions.|L<Reflex::Callbacks> documents callback convenience functions.> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L<Reflex/ACKNOWLEDGEMENTS> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L<Reflex/ASSISTANCE> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L<Reflex/AUTHORS> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L<Reflex/BUGS> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L<Reflex/BUGS> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L<Reflex/CONTRIBUTORS> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L<Reflex/COPYRIGHT> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<Reflex/LICENSE> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L<Reflex/TODO> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=back |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
You can make new bug reports, and view existing ones, through the |
132
|
|
|
|
|
|
|
web interface at L<http://rt.cpan.org/Public/Dist/Display.html?Name=Reflex>. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Rocco Caputo <rcaputo@cpan.org> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Rocco Caputo. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
143
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 AVAILABILITY |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
The latest version of this module is available from the Comprehensive Perl |
148
|
|
|
|
|
|
|
Archive Network (CPAN). Visit L<http://www.perl.com/CPAN/> to find a CPAN |
149
|
|
|
|
|
|
|
site near you, or see L<https://metacpan.org/module/Reflex/>. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTY |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
154
|
|
|
|
|
|
|
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT |
155
|
|
|
|
|
|
|
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER |
156
|
|
|
|
|
|
|
PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, |
157
|
|
|
|
|
|
|
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
158
|
|
|
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
159
|
|
|
|
|
|
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE |
160
|
|
|
|
|
|
|
SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME |
161
|
|
|
|
|
|
|
THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
164
|
|
|
|
|
|
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
165
|
|
|
|
|
|
|
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE |
166
|
|
|
|
|
|
|
TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR |
167
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE |
168
|
|
|
|
|
|
|
SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
169
|
|
|
|
|
|
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
170
|
|
|
|
|
|
|
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
171
|
|
|
|
|
|
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
172
|
|
|
|
|
|
|
DAMAGES. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=cut |