File Coverage

blib/lib/Protocol/WebSocket/Handshake.pm
Criterion Covered Total %
statement 20 21 95.2
branch 3 4 75.0
condition 4 6 66.6
subroutine 8 9 88.8
pod 5 5 100.0
total 40 45 88.8


line stmt bran cond sub pod time code
1             package Protocol::WebSocket::Handshake;
2              
3 9     9   59 use strict;
  9         15  
  9         206  
4 9     9   38 use warnings;
  9         14  
  9         181  
5              
6 9     9   4209 use Protocol::WebSocket::Request;
  9         24  
  9         241  
7 9     9   3443 use Protocol::WebSocket::Response;
  9         29  
  9         1332  
8              
9             sub new {
10 28     28 1 1915 my $class = shift;
11 28 50       70 $class = ref $class if ref $class;
12              
13 28         63 my $self = {@_};
14 28         46 bless $self, $class;
15              
16 28         81 return $self;
17             }
18              
19 17 100   17 1 107 sub error { @_ > 1 ? $_[0]->{error} = $_[1] : $_[0]->{error} }
20              
21 0     0 1 0 sub version { $_[0]->req->version }
22              
23 188   66 188 1 756 sub req { shift->{req} ||= Protocol::WebSocket::Request->new }
24 97   66 97 1 366 sub res { shift->{res} ||= Protocol::WebSocket::Response->new }
25              
26             1;
27             __END__