line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PocketIO::Room; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
104
|
use strict; |
|
14
|
|
|
|
|
32
|
|
|
14
|
|
|
|
|
531
|
|
4
|
14
|
|
|
14
|
|
72
|
use warnings; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
367
|
|
5
|
|
|
|
|
|
|
|
6
|
14
|
|
|
14
|
|
73
|
use PocketIO::Message; |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
3673
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
1
|
|
|
1
|
0
|
2
|
my $class = shift; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
4
|
my $self = {@_}; |
12
|
1
|
|
|
|
|
3
|
bless $self, $class; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
|
|
3
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub send { |
18
|
1
|
|
|
1
|
0
|
7
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
9
|
$self->{pool}->send_raw( |
21
|
|
|
|
|
|
|
room => $self->{room}, |
22
|
|
|
|
|
|
|
invoker => $self->{conn}, |
23
|
|
|
|
|
|
|
message => $_[0], |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
12
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub emit { |
30
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
31
|
0
|
|
|
|
|
|
my $name = shift; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $event = $self->_build_event_message($name, @_); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$self->{pool}->send_raw( |
36
|
|
|
|
|
|
|
room => $self->{room}, |
37
|
|
|
|
|
|
|
invoker => $self->{conn}, |
38
|
|
|
|
|
|
|
message => $event |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
return $self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _build_event_message { |
45
|
0
|
|
|
0
|
|
|
my $self = shift; |
46
|
0
|
|
|
|
|
|
my $event = shift; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
return PocketIO::Message->new( |
49
|
|
|
|
|
|
|
type => 'event', |
50
|
|
|
|
|
|
|
data => {name => $event, args => [@_]} |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |