line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnySan; |
2
|
1
|
|
|
1
|
|
19954
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
51
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1879
|
use AnyEvent; |
|
1
|
|
|
|
|
5962
|
|
|
1
|
|
|
|
|
198
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my $condvar = AE::cv; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
|
sub cv { $condvar } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run { |
13
|
0
|
|
|
0
|
0
|
|
$condvar->recv; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my @hooks = (); |
18
|
|
|
|
|
|
|
sub register_listener { |
19
|
0
|
|
|
0
|
0
|
|
my($class, $name, $args) = @_; |
20
|
0
|
|
0
|
|
|
|
$args->{event} ||= 'privmsg'; |
21
|
0
|
|
|
|
|
|
push @hooks, $args; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub broadcast_message { |
25
|
0
|
|
|
0
|
0
|
|
my($class, $receive) = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
for my $hook (@hooks) { |
28
|
0
|
0
|
|
|
|
|
next unless $hook->{event} eq $receive->event; |
29
|
0
|
|
|
|
|
|
$hook->{cb}->($receive); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
__END__ |