| 1 | package Linux::Event::WebSocket::Client::_HTTPConnection; | ||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use v5.36; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use parent 'Linux::Event::HTTP::Client::Connection'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use Linux::Event::Framer (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use Linux::Event::WebSocket::_BQ (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | ▶ | sub can ($class, $name) { | |||||||||||||||||||||||||||
|
Subroutine
can: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 67 | ▶ | return undef if $name eq 'on_data'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 16 | 62 | return UNIVERSAL::can($class, $name); | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | ▶ | sub _websocket_http_input ($self, $bytes) { | |||||||||||||||||||||||||||
|
Subroutine
_websocket_http_input: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 7 | return Linux::Event::HTTP::Client::Connection::on_data($self, $bytes); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 6 | Linux::Event::Framer->declare_native_consumer( | |||||||||||||||||||||||||||
| 24 | __PACKAGE__, | ||||||||||||||||||||||||||||
| 25 | Linux::Event::WebSocket::_BQ->http_bridge_consumer_definition, | ||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | ▶ | sub _websocket_state ($self) { | |||||||||||||||||||||||||||
|
Subroutine
_websocket_state: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 29 | 0 | my $state = $self->SUPER::data; | |||||||||||||||||||||||||||
| 30 | 0 | ▶ | croak 'WebSocket client connection state is unavailable' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($state) and $state->isa("Linux::Event::WebSocket::_State")
MC/DC0%0/2
builtin::blessed($state) and $state->isa("Linux::Event::WebSocket::_State")
builtin::blessed($state)
$state->isa("Linux::Event::WebSocket::_State")
Truth table0%0/3
A and B
A= builtin::blessed($state)B= $state->isa("Linux::Event::WebSocket::_State")
| |||||||||||||||||||||||||||||
| 31 | if !blessed($state) | ||||||||||||||||||||||||||||
| 32 | || !$state->isa('Linux::Event::WebSocket::_State'); | ||||||||||||||||||||||||||||
| 33 | 0 | return $state; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | ▶ | sub data ($self, @value) { | |||||||||||||||||||||||||||
|
Subroutine
data: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | 0 | my $state = $self->_websocket_state; | |||||||||||||||||||||||||||
| 38 | 0 | ▶ | croak 'data() accepts at most one value' if @value > 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $state->{data} = $value[0] if @value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | return $state->{data}; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | # HTTP Client::Connection captures this method as its user drain handler and | ||||||||||||||||||||||||||||
| 44 | # keeps that constructor override through transition_to(). Forward it after the | ||||||||||||||||||||||||||||
| 45 | # same object becomes a WebSocket connection. | ||||||||||||||||||||||||||||
| 46 | ▶ | sub on_drain ($self) { | |||||||||||||||||||||||||||
|
Subroutine
on_drain: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if ($self->isa('Linux::Event::WebSocket::Connection')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | Linux::Event::WebSocket::Connection::on_drain($self); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | 0 | return; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 6 | 1; | |||||||||||||||||||||||||||