File Coverage

blib/lib/PocketIO/Transport/Base.pm
Criterion Covered Total %
statement 9 25 36.0
branch 0 2 0.0
condition n/a
subroutine 3 8 37.5
pod 5 5 100.0
total 17 40 42.5


line stmt bran cond sub pod time code
1             package PocketIO::Transport::Base;
2              
3 6     6   39 use strict;
  6         15  
  6         252  
4 6     6   33 use warnings;
  6         12  
  6         176  
5              
6 6     6   37 use Scalar::Util qw(weaken);
  6         13  
  6         1794  
7              
8             sub new {
9 0     0 1   my $class = shift;
10              
11 0           my $self = bless {@_}, $class;
12              
13 0           weaken $self->{env};
14 0           weaken $self->{conn};
15              
16 0           return $self;
17             }
18              
19 0     0 1   sub env { $_[0]->{env} }
20 0     0 1   sub conn { $_[0]->{conn} }
21              
22             sub client_connected {
23 0     0 1   my $self = shift;
24 0           my ($conn) = @_;
25              
26 0 0         return if $conn->is_connected;
27              
28 0           $conn->connected;
29             }
30              
31             sub client_disconnected {
32 0     0 1   my $self = shift;
33 0           my ($conn) = @_;
34              
35 0           $conn->disconnected;
36              
37 0           $self->{on_disconnect}->($self);
38              
39 0           return $self;
40             }
41              
42             1;
43             __END__