line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moo::Role::RequestReplyHandler::EventListener; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
304
|
use Carp 'croak'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
5
|
1
|
|
|
1
|
|
5
|
use Filter::signatures; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
6
|
1
|
|
|
1
|
|
31
|
no warnings 'experimental::signatures'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
7
|
1
|
|
|
1
|
|
6
|
use feature 'signatures'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
313
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'target' => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
weak_ref => 1, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'callback' => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'event' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
around BUILDARGS => sub( $orig, $class, %args ) { |
25
|
|
|
|
|
|
|
croak "Need an event" unless $args{ event }; |
26
|
|
|
|
|
|
|
croak "Need a callback" unless $args{ callback }; |
27
|
|
|
|
|
|
|
croak "Need a target in target" unless $args{ target }; |
28
|
|
|
|
|
|
|
return $class->$orig( %args ) |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
0
|
|
sub notify( $self, @info ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
$self->callback->( @info ) |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
0
|
|
sub unregister( $self ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$self->target->remove_listener( $self ) |
37
|
|
|
|
|
|
|
if $self->target; # it's a weak ref so it might have gone away already |
38
|
0
|
|
|
|
|
|
undef $self->{target}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub DESTROY { |
42
|
0
|
|
|
0
|
|
|
$_[0]->unregister |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |