File Coverage

blib/lib/PocketIO/Broadcast.pm
Criterion Covered Total %
statement 20 23 86.9
branch n/a
condition n/a
subroutine 6 7 85.7
pod 3 3 100.0
total 29 33 87.8


line stmt bran cond sub pod time code
1             package PocketIO::Broadcast;
2              
3 14     14   82 use strict;
  14         26  
  14         488  
4 14     14   76 use warnings;
  14         30  
  14         370  
5              
6 14     14   78 use base 'PocketIO::Sockets';
  14         26  
  14         1344  
7              
8 14     14   81 use PocketIO::Room;
  14         27  
  14         8739  
9              
10             sub send {
11 1     1 1 1241 my $self = shift;
12              
13 1         11 $self->{pool}->broadcast($self->{conn}, @_);
14              
15 1         3 return $self;
16             }
17              
18             sub emit {
19 1     1 1 8 my $self = shift;
20 1         3 my $name = shift;
21              
22 1         16 my $event = $self->_build_event_message($name, @_);
23              
24 1         144 $self->{pool}->broadcast($self->{conn}, $event);
25              
26 1         344 return $self;
27             }
28              
29              
30             sub to {
31 0     0 1   my $self = shift;
32 0           my ($room) = @_;
33              
34 0           return PocketIO::Room->new(
35             room => $room,
36             conn => $self->{conn},
37             pool => $self->{pool}
38             );
39             }
40              
41             1;
42             __END__