blib/lib/Linux/Event/WebSocket/_Engine.pm

filter: Statementstmt 96.4% 136 / 141 Branchbran 70.2% 59 / 84 Conditioncond 50.0% 43 / 86 MC/DCmcdc 14.5% 7 / 48 Subroutinesub 100% 26 / 26 Podpod 0.0% 0 / 7 totaltotal 69.1% 271 / 392 CC 77 SCAR 23.4
CC
77
Cov
77%
new
34.8
_bq_event
7.4
_finish_feed
7.3
CRAP 10.4
« blib/lib/Linux/Event/WebSocket/_Random.pm ↑ Summary blib/lib/Linux/Event/WebSocket/Client/_HTTPConnection.pm »
1 package Linux::Event::WebSocket::_Engine;
2 9 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 9 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 ▶use Scalar::Util qw(blessed weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 9 ▶use Linux::Event::WebSocket::_BQ;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use Linux::Event::WebSocket::_Frame;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use Linux::Event::WebSocket::_UTF8;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 47 ▶sub new ($class, %option) {
Subroutine new: called CC=18 SCAR=35.5
Pod undocumented
14 47 my $connection = delete $option{connection};
15 47 ▶ croak 'new(): connection object is required'
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($connection) and $connection->can("write") 0 47 47
Condition33%1/3
builtin::blessed($connection) and $connection->can("write")
!ll&&!rl&&r
0047
MC/DC0%0/2
builtin::blessed($connection) and $connection->can("write")
builtin::blessed($connection) $connection->can("write")
Truth table33%1/3
A and B
A= builtin::blessed($connection)B= $connection->can("write")
ABresult
0X0
100
111
16 if !blessed($connection) || !$connection->can('write');
17  
18 47 my $endpoint_type = delete $option{endpoint_type};
19 47 ▶ croak 'new(): endpoint_type must be client or server'
Branch: 1 branch
BranchTrueFalseTotal
if not defined $endpoint_type or $endpoint_type ne "client" and $endpoint_type ne "server" 0 47 47
Condition50%3/6
not defined $endpoint_type or $endpoint_type ne "client" and $endpoint_type ne "server"
l!l&&r!l&&!r
0047
$endpoint_type ne "client" and $endpoint_type ne "server"
!ll&&!rl&&r
9380
MC/DC0%0/3
not defined $endpoint_type or $endpoint_type ne "client" and $endpoint_type ne "server"
not defined $endpoint_type $endpoint_type ne "client" $endpoint_type ne "server"
Truth table50%2/4
not(A) or B and C
A= not defined $endpoint_typeB= $endpoint_type ne "client"C= $endpoint_type ne "server"
ABCresult
1XX1
0111
00X0
0100
20 if !defined($endpoint_type)
21 || ($endpoint_type ne 'client' && $endpoint_type ne 'server');
22  
23 47 my $message_handler_supplied = exists $option{message_handler};
24 47 my $message_handler = delete $option{message_handler};
25 47 ▶ croak 'new(): message_handler must be a coderef'
Branch: 1 branch
BranchTrueFalseTotal
if defined $message_handler and ref $message_handler ne "CODE" 0 47 47
Condition66%2/3
defined $message_handler and ref $message_handler ne "CODE"
!ll&&!rl&&r
37100
MC/DC0%0/2
defined $message_handler and ref $message_handler ne "CODE"
defined $message_handler ref $message_handler ne "CODE"
Truth table66%2/3
A and B
A= defined $message_handlerB= ref $message_handler ne "CODE"
ABresult
0X0
100
111
26 if defined($message_handler) && ref($message_handler) ne 'CODE';
27  
28 47 my $max_message_size = delete $option{max_message_size};
29 47 ▶ croak 'new(): max_message_size must be a positive integer'
Branch: 1 branch
BranchTrueFalseTotal
if not defined $max_message_size or ref $max_message_size or not "$max_message_size" =~ /\A[0-9]+\z/u or $max_message_size < 1 0 47 47
Condition33%3/9
not defined $max_message_size or ref $max_message_size or not "$max_message_size" =~ /\A[0-9]+\z/u or $max_message_size < 1
l!l&&r!l&&!r
0047
not defined $max_message_size or ref $max_message_size or not "$max_message_size" =~ /\A[0-9]+\z/u
l!l&&r!l&&!r
0047
not defined $max_message_size or ref $max_message_size
l!l&&r!l&&!r
0047
MC/DC0%0/4
not defined $max_message_size or ref $max_message_size or not "$max_message_size" =~ /\A[0-9]+\z/u or $max_message_size < 1
not defined $max_message_size ref $max_message_size not "$max_message_size" =~ /\A[0-9]+\z/u $max_message_size < 1
Truth table20%1/5
not(A) or B or not(C) or D
A= not defined $max_message_sizeB= ref $max_message_sizeC= not "$max_message_size" =~ /\A[0-9]+\z/uD= $max_message_size < 1
ABCDresult
1XXX1
01XX1
001X1
00011
00000
30 if !defined($max_message_size) || ref($max_message_size)
31 || "$max_message_size" !~ /\A[0-9]+\z/ || $max_message_size < 1;
32  
33 47 my $native = delete $option{native};
34 47 ▶ croak 'new(): native must be a Linux::Event::WebSocket::_BQ object'
Branch: 1 branch
BranchTrueFalseTotal
if defined $native and not builtin::blessed($native) && $native->isa("Linux::Event::WebSocket::_BQ") 0 47 47
Condition50%3/6
defined $native and not builtin::blessed($native) && $native->isa("Linux::Event::WebSocket::_BQ")
!ll&&!rl&&r
4520
builtin::blessed($native) && $native->isa('Linux::Event::WebSocket::_BQ')
!ll&&!rl&&r
002
MC/DC0%0/3
defined $native and not builtin::blessed($native) && $native->isa("Linux::Event::WebSocket::_BQ")
defined $native builtin::blessed($native) $native->isa('Linux::Event::WebSocket::_BQ')
Truth table50%2/4
A and not(B && C)
A= defined $nativeB= builtin::blessed($native)C= $native->isa('Linux::Event::WebSocket::_BQ')
ABCresult
0XX0
1110
10X1
1101
35 if defined($native)
36 && (!blessed($native)
37 || !$native->isa('Linux::Event::WebSocket::_BQ'));
38  
39 47 ▶ croak 'new(): unknown option(s): ' . join(', ', sort keys %option)
Branch: 1 branch
BranchTrueFalseTotal
if %option 0 47 47
40 if %option;
41  
42 47 ▶ my $self = bless {
Branch: 1 branch
BranchTrueFalseTotal
$message_handler_supplied ? : 16 31 47
Condition66%2/3
$native // "Linux::Event::WebSocket::_BQ"->new($endpoint_type, $max_message_size)
l!l&&r!l&&!r
2450
MC/DC0%0/2
$native // "Linux::Event::WebSocket::_BQ"->new($endpoint_type, $max_message_size)
$native "Linux::Event::WebSocket::_BQ"->new($endpoint_type, $max_message_size)
Truth table66%2/3
A // B
A= $nativeB= "Linux::Event::WebSocket::_BQ"->new($endpoint_type, $max_message_size)
ABresult
1X1
011
000
43 connection => $connection,
44 endpoint_type => $endpoint_type,
45 message_handler_supplied => $message_handler_supplied ? 1 : 0,
46 message_handler => $message_handler,
47 max_message_size => 0 + $max_message_size,
48 native => $native // Linux::Event::WebSocket::_BQ->new(
49 $endpoint_type,
50 $max_message_size,
51 ),
52 sent_close => 0,
53 received_close => 0,
54 failed => 0,
55 in_feed => 0,
56 pending_end => 0,
57 }, $class;
58 47 weaken($self->{connection});
59 47 return $self;
60 }
61  
62 54 ▶sub _connection ($self) {
Subroutine _connection: called CC=2 SCAR=7.6
63 return $self->{connection}
64 54 ▶ // die "WebSocket connection was destroyed while its engine remained alive\n";
Condition50%1/2
$self->{"connection"} // die("WebSocket connection was destroyed while its engine remained alive\n")
l!l
540
MC/DC0%0/1
$self->{"connection"} // die("WebSocket connection was destroyed while its engine remained alive\n")
$self->{"connection"}
Truth table50%1/2
A
A= $self->{"connection"}
Aresult
11
00
65 }
66  
67 2 ▶sub is_closing ($self) {
Subroutine is_closing: called CC=2 SCAR=9.2
Pod undocumented
68 2 ▶ return !!($self->{sent_close} || $self->{received_close});
Condition33%1/3
$self->{'sent_close'} || $self->{'received_close'}
l!l&&r!l&&!r
002
MC/DC0%0/2
$self->{'sent_close'} || $self->{'received_close'}
$self->{'sent_close'} $self->{'received_close'}
Truth table33%1/3
A || B
A= $self->{'sent_close'}B= $self->{'received_close'}
ABresult
1X1
011
000
69 }
70  
71 51 ▶sub _flush ($self, $connection = undef) {
Subroutine _flush: called CC=6 SCAR=18.0
72 51 ▶ return 0 if $self->{in_feed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"in_feed"} 9 42 51
73  
74 42 my $wire = $self->{native}->flush;
75 42 ▶ return 0 if !length $wire;
Branch: 1 branch
BranchTrueFalseTotal
unless length $wire 13 29 42
76  
77 29 ▶ $connection //= $self->_connection;
Condition66%2/3
$connection //= $self->_connection
l!l&&r!l&&!r
2270
MC/DC0%0/2
$connection //= $self->_connection
$connection $self->_connection
Truth table66%2/3
A //= B
A= $connectionB= $self->_connection
ABresult
1X1
011
000
78 29 ▶ return 0 if $connection->is_closed;
Branch: 1 branch
BranchTrueFalseTotal
if $connection->is_closed 0 29 29
79 29 return $connection->write($wire);
80 }
81  
82 16 ▶sub _queue_message ($self, $opcode, $bytes) {
Subroutine _queue_message: called CC=1 SCAR=0.0
83 16 $self->{native}->queue_message($opcode, $bytes);
84 13 return $self->_flush;
85 }
86  
87 12 ▶sub send_text ($self, $bytes) {
Subroutine send_text: called CC=3 SCAR=13.1
Pod undocumented
88 croak 'send_text(): WebSocket connection is closing'
89 12 ▶ if $self->{sent_close} || $self->{received_close};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"sent_close"} or $self->{"received_close"} 0 12 12
Condition33%1/3
$self->{"sent_close"} or $self->{"received_close"}
l!l&&r!l&&!r
0012
MC/DC0%0/2
$self->{"sent_close"} or $self->{"received_close"}
$self->{"sent_close"} $self->{"received_close"}
Truth table33%1/3
A or B
A= $self->{"sent_close"}B= $self->{"received_close"}
ABresult
1X1
011
000
90 12 return $self->_queue_message(1, $bytes);
91 }
92  
93 3 ▶sub send_binary ($self, $bytes) {
Subroutine send_binary: called CC=3 SCAR=13.1
Pod undocumented
94 croak 'send_binary(): WebSocket connection is closing'
95 3 ▶ if $self->{sent_close} || $self->{received_close};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"sent_close"} or $self->{"received_close"} 0 3 3
Condition33%1/3
$self->{"sent_close"} or $self->{"received_close"}
l!l&&r!l&&!r
003
MC/DC0%0/2
$self->{"sent_close"} or $self->{"received_close"}
$self->{"sent_close"} $self->{"received_close"}
Truth table33%1/3
A or B
A= $self->{"sent_close"}B= $self->{"received_close"}
ABresult
1X1
011
000
96 3 return $self->_queue_message(2, $bytes);
97 }
98  
99 2 ▶sub ping ($self, $bytes = '') {
Subroutine ping: called CC=4 SCAR=13.9
Pod undocumented
100 2 ▶ croak 'ping(): WebSocket connection is closing' if $self->is_closing;
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_closing 0 2 2
101 2 ▶ croak 'ping(): control frame payload exceeds 125 bytes'
Branch: 1 branch
BranchTrueFalseTotal
if length $bytes > 125 1 1 2
102 if length($bytes) > 125;
103 1 return $self->_queue_message(9, $bytes);
104 }
105  
106 6 ▶sub start_close ($self, $code, $reason = '') {
Subroutine start_close: called CC=4 SCAR=14.0
Pod undocumented
107 6 ▶ return $self if $self->{sent_close};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"sent_close"} 0 6 6
108  
109 6 ▶ croak 'close reason exceeds 123 bytes' if length($reason) > 123;
Branch: 1 branch
BranchTrueFalseTotal
if length $reason > 123 0 6 6
110 6 my $number = Linux::Event::WebSocket::_Frame->close_code($code);
111 6 $self->{native}->queue_close($number, $reason);
112 6 $self->{sent_close} = 1;
113  
114 6 my $connection = $self->_connection;
115 6 $connection->_websocket_engine_closing;
116 6 $self->_flush($connection);
117 6 return $self;
118 }
119  
120 5 ▶sub _failure_message ($error, $name) {
Subroutine _failure_message: called CC=6 SCAR=18.3
121 5 ▶ return 'WebSocket message exceeds configured limit'
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "LIMIT_MAX_RECV_MSG_SIZE" 0 5 5
122 if $name eq 'LIMIT_MAX_RECV_MSG_SIZE';
123 5 ▶ return 'WebSocket continuation frame received outside a fragmented message'
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "BAD_CONTINUATION" 1 4 5
124 if $name eq 'BAD_CONTINUATION';
125 4 ▶ return 'WebSocket data frame received while a fragmented message is unfinished'
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "UNFINISHED_PARTIAL" 1 3 4
126 if $name eq 'UNFINISHED_PARTIAL';
127 3 ▶ return 'WebSocket close frame has a one-byte payload or invalid status code'
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "BAD_CLOSE" 2 1 3
128 if $name eq 'BAD_CLOSE';
129 1 ▶ return 'WebSocket close frame contains invalid UTF-8 reason'
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "BAD_UTF8" 1 0 1
130 if $name eq 'BAD_UTF8';
131 0 return "WebSocket protocol error ($name)";
132 }
133  
134 15 ▶sub _fail ($self, $message, $code, $native_has_close = 0) {
Subroutine _fail: called CC=6 SCAR=18.1
135 15 ▶ return if $self->{failed}++;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"failed"}++ 0 15 15
136  
137 15 my $connection = $self->_connection;
138 15 $connection->_websocket_engine_error($message);
139  
140 15 ▶ if (!$native_has_close && !$self->{sent_close} && !$connection->is_closed) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($native_has_close or $self->{"sent_close"} or $connection->is_closed) 10 5 15
Condition66%4/6
$native_has_close or $self->{"sent_close"} or $connection->is_closed
l!l&&r!l&&!r
5010
$native_has_close or $self->{"sent_close"}
l!l&&r!l&&!r
5010
MC/DC33%1/3
$native_has_close or $self->{"sent_close"} or $connection->is_closed
$native_has_close $self->{"sent_close"} $connection->is_closed
Truth table50%2/4
A or B or C
A= $native_has_closeB= $self->{"sent_close"}C= $connection->is_closed
ABCresult
1XX1
01X1
0011
0000
141 10 $self->{native}->queue_close($code, '');
142 }
143  
144 15 $self->{sent_close} = 1;
145 15 $connection->_websocket_engine_closing;
146 15 $self->{pending_end} = 1;
147 15 return;
148 }
149  
150 20 ▶sub _deliver ($self, $opcode, $payload, $connection) {
Subroutine _deliver: called CC=7 SCAR=19.8
151 20 ▶ return 0 if $self->{failed} || $self->{received_close};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"failed"} or $self->{"received_close"} 0 20 20
Condition33%1/3
$self->{"failed"} or $self->{"received_close"}
l!l&&r!l&&!r
0020
MC/DC0%0/2
$self->{"failed"} or $self->{"received_close"}
$self->{"failed"} $self->{"received_close"}
Truth table33%1/3
A or B
A= $self->{"failed"}B= $self->{"received_close"}
ABresult
1X1
011
000
152  
153 20 ▶ if (length($payload) > $self->{max_message_size}) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $payload > $self->{"max_message_size"}) 1 19 20
154 1 $self->_fail('WebSocket message exceeds configured limit', 1009);
155 1 return 0;
156 }
157  
158 19 ▶ my $type = $opcode == 1 ? 'text' : 'binary';
Branch: 1 branch
BranchTrueFalseTotal
$opcode == 1 ? : 16 3 19
159  
160 19 ▶ if ($self->{message_handler_supplied}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'message_handler_supplied'}) { } 12 7 19
161 12 ▶ if (my $handler = $self->{message_handler}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $handler = $self->{"message_handler"}) 12 0 12
162 12 $handler->($connection, $payload, $type);
163 }
164 } else {
165 7 $connection->_websocket_engine_message($payload, $type);
166 }
167 19 return !$connection->is_closed;
168 }
169  
170 10 ▶sub _handle_close ($self, $payload, $connection) {
Subroutine _handle_close: called CC=5 SCAR=17.1
171 10 ▶ return 0 if $self->{received_close};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"received_close"} 0 10 10
172  
173 10 my ($code, $reason);
174 10 my $ok = eval {
175 10 ($code, $reason) =
176 Linux::Event::WebSocket::_Frame->parse_close_payload($payload);
177 10 1;
178 };
179 10 ▶ if (!$ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 0 10 10
180 0 $self->_fail($@, 1002);
181 0 return 0;
182 }
183  
184 10 my $decoded = '';
185 10 ▶ if (length $reason) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $reason) 10 0 10
186 10 $decoded = eval { Linux::Event::WebSocket::_UTF8->decode($reason) };
187 10 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 10 10
188 0 $self->_fail('invalid UTF-8 in WebSocket close reason', 1007);
189 0 return 0;
190 }
191 }
192  
193 10 $self->{received_close} = 1;
194 10 $self->{sent_close} = 1;
195 10 $connection->_websocket_engine_closing;
196 10 $connection->_websocket_engine_close($code, $decoded);
197 10 $self->{pending_end} = 1;
198 10 return 0;
199 }
200  
201 9 ▶sub _bq_invalid_utf8 ($self, $connection) {
Subroutine _bq_invalid_utf8: called CC=4 SCAR=17.1
202 return if $self->{failed} || $self->{received_close}
203 9 ▶ || $connection->is_closed;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"failed"} or $self->{"received_close"} or $connection->is_closed 0 9 9
Condition33%2/6
$self->{"failed"} or $self->{"received_close"} or $connection->is_closed
l!l&&r!l&&!r
009
$self->{"failed"} or $self->{"received_close"}
l!l&&r!l&&!r
009
MC/DC0%0/3
$self->{"failed"} or $self->{"received_close"} or $connection->is_closed
$self->{"failed"} $self->{"received_close"} $connection->is_closed
Truth table25%1/4
A or B or C
A= $self->{"failed"}B= $self->{"received_close"}C= $connection->is_closed
ABCresult
1XX1
01X1
0011
0000
204 9 $self->_fail('invalid UTF-8 in WebSocket text message', 1007);
205 9 return;
206 }
207  
208 31 ▶sub _bq_event ($self, $connection, $opcode, $payload) {
Subroutine _bq_event: called CC=7 SCAR=20.0
209 return if $self->{failed} || $self->{received_close}
210 31 ▶ || $connection->is_closed;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"failed"} or $self->{"received_close"} or $connection->is_closed 1 30 31
Condition50%3/6
$self->{"failed"} or $self->{"received_close"} or $connection->is_closed
l!l&&r!l&&!r
0130
$self->{"failed"} or $self->{"received_close"}
l!l&&r!l&&!r
0031
MC/DC33%1/3
$self->{"failed"} or $self->{"received_close"} or $connection->is_closed
$self->{"failed"} $self->{"received_close"} $connection->is_closed
Truth table50%2/4
A or B or C
A= $self->{"failed"}B= $self->{"received_close"}C= $connection->is_closed
ABCresult
1XX1
01X1
0011
0000
211  
212 30 ▶ if ($opcode == 1 || $opcode == 2) {
Branch: 2 branches
BranchTrueFalseTotal
if ($opcode == 1 or $opcode == 2) { } 20 10 30
elsif ($opcode == 8) { } 10 0 10
Condition100%3/3
$opcode == 1 or $opcode == 2
l!l&&r!l&&!r
16410
MC/DC100%2/2
$opcode == 1 or $opcode == 2
$opcode == 1 $opcode == 2
Truth table100%3/3
A or B
A= $opcode == 1B= $opcode == 2
ABresult
1X1
011
000
213 20 $self->_deliver($opcode, $payload, $connection);
214 } elsif ($opcode == 8) {
215 10 $self->_handle_close($payload, $connection);
216 }
217 30 return;
218 }
219  
220 26 ▶sub _handle_bq_error ($self, $error, $error_name) {
Subroutine _handle_bq_error: called CC=5 SCAR=16.1
221 26 ▶ return if $self->{failed} || !$error;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"failed"} or not $error 21 5 26
Condition100%3/3
$self->{"failed"} or not $error
l!l&&r!l&&!r
10115
MC/DC100%2/2
$self->{"failed"} or not $error
$self->{"failed"} not $error
Truth table100%3/3
A or not(B)
A= $self->{"failed"}B= not $error
ABresult
1X1
011
000
222 5 ▶ $self->_fail(
Branch: 2 branches
BranchTrueFalseTotal
$error_name eq 'LIMIT_MAX_RECV_MSG_SIZE' ? : 0 5 5
$error_name eq 'BAD_UTF8' ? : 1 4 5
223 _failure_message($error, $error_name),
224 $error_name eq 'LIMIT_MAX_RECV_MSG_SIZE' ? 1009
225 : $error_name eq 'BAD_UTF8' ? 1007 : 1002,
226 1,
227 );
228 5 return;
229 }
230  
231 34 ▶sub _finish_feed ($self, $connection = undef) {
Subroutine _finish_feed: called CC=7 SCAR=19.9
232 34 ▶ $connection //= $self->_connection;
Condition33%1/3
$connection //= $self->_connection
l!l&&r!l&&!r
3400
MC/DC0%0/2
$connection //= $self->_connection
$connection $self->_connection
Truth table33%1/3
A //= B
A= $connectionB= $self->_connection
ABresult
1X1
011
000
233 34 $self->{in_feed} = 0;
234 34 ▶ $self->_flush($connection) if !$connection->is_closed;
Branch: 1 branch
BranchTrueFalseTotal
unless $connection->is_closed 32 2 34
235  
236 34 ▶ if ($self->{pending_end}
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"pending_end"} and not $connection->is_write_ended and not $connection->is_closed) 24 10 34
Condition66%4/6
$self->{"pending_end"} and not $connection->is_write_ended and not $connection->is_closed
!ll&&!rl&&r
10024
$self->{"pending_end"} and not $connection->is_write_ended
!ll&&!rl&&r
10024
MC/DC33%1/3
$self->{"pending_end"} and not $connection->is_write_ended and not $connection->is_closed
$self->{"pending_end"} not $connection->is_write_ended not $connection->is_closed
Truth table50%2/4
A and not(B) and not(C)
A= $self->{"pending_end"}B= not $connection->is_write_endedC= not $connection->is_closed
ABCresult
0XX0
10X0
1100
1111
237 && !$connection->is_write_ended
238 && !$connection->is_closed) {
239 24 $self->{pending_end} = 0;
240 24 $connection->end;
241 }
242 34 return;
243 }
244  
245 26 ▶sub feed ($self, $bytes) {
Subroutine feed: called CC=4 SCAR=15.2
Pod undocumented
246 26 my $connection = $self->_connection;
247 return if $self->{failed} || $self->{received_close}
248 26 ▶ || $connection->is_closed;
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"failed"} or $self->{"received_close"} or $connection->is_closed 0 26 26
Condition33%2/6
$self->{"failed"} or $self->{"received_close"} or $connection->is_closed
l!l&&r!l&&!r
0026
$self->{"failed"} or $self->{"received_close"}
l!l&&r!l&&!r
0026
MC/DC0%0/3
$self->{"failed"} or $self->{"received_close"} or $connection->is_closed
$self->{"failed"} $self->{"received_close"} $connection->is_closed
Truth table25%1/4
A or B or C
A= $self->{"failed"}B= $self->{"received_close"}C= $connection->is_closed
ABCresult
1XX1
01X1
0011
0000
249  
250 26 $self->{in_feed} = 1;
251 my ($error, $error_name) =
252 26 $self->{native}->feed($self, $connection, $bytes);
253  
254 26 $self->_handle_bq_error($error, $error_name);
255 26 $self->_finish_feed($connection);
256 26 return;
257 }
258  
259 9 1;
« blib/lib/Linux/Event/WebSocket/_Random.pm ↑ Summary blib/lib/Linux/Event/WebSocket/Client/_HTTPConnection.pm »