WebSocket/Server.pm

filter: Statementstmt 14.0% 119 / 847 Branchbran 0.1% 1 / 892 Conditioncond 0.0% 0 / 301 MC/DCmcdc 0.0% 0 / 156 Subroutinesub 38.0% 38 / 100 Podpod 100% 31 / 31 totaltotal 8.1% 189 / 2327 CC 556 SCAR 108.2
CC
556
Cov
6%
start
97448.3
shutdown
8678.8
__ANON__
418.4
CRAP 50144.0
« WebSocket/Client.pm ↑ Summary WebSocket/Headers.pm »
1 ##----------------------------------------------------------------------------
2 ## WebSocket Client & Server - ~/lib/WebSocket/Server.pm
3 ## Version v0.2.0
4 ## Copyright(c) 2023 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2021/09/13
7 ## Modified 2023/04/29
8 ## You can use, copy, modify and redistribute this package and associated
9 ## files under the same terms as Perl itself.
10 ##----------------------------------------------------------------------------
11 package WebSocket::Server;
12 BEGIN
13 2 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶ use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
18 # Import constants
19 2 ▶ use WebSocket qw( :ws );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶ use parent qw( WebSocket );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶ use IO::Socket::INET;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶ use IO::Select;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶ use List::Util qw( min );
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶ use Nice::Try;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 ▶ use Want;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶ use WebSocket::Connection;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶ use WebSocket::Version;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 our $VERSION = 'v0.2.0';
29 2 $SIG{PIPE} = 'IGNORE';
30 };
31  
32 sub init
33 0 ▶{
Subroutine init: not called CC=18 SCAR=58.3
Pod documented
34 0 my $self = shift( @_ );
35 0 ▶ my $class = ref( $self ) || $self;
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
36 # We are careful not to override object default value set by child class inheriting from our class
37 0 ▶ $self->{connection_class} = 'WebSocket::Connection' unless( defined( $self->{connection_class} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"connection_class"} 0 0 0
38 # If true, connections will return a list, otherwise it will return an array object
39 0 ▶ $self->{legacy} = 0 unless( defined( $self->{legacy} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"legacy"} 0 0 0
40 0 ▶ $self->{listen} = undef() unless( defined( $self->{listen} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"listen"} 0 0 0
41 0 ▶ $self->{on_accept} = sub{} unless( defined( $self->{on_accept} ) );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"on_accept"} 0 0 0
42 0 ▶ $self->{on_connect} = sub{} unless( defined( $self->{on_connect} ) );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"on_connect"} 0 0 0
43 0 ▶ $self->{on_shutdown} = sub{} unless( defined( $self->{on_shutdown} ) );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"on_shutdown"} 0 0 0
44 0 ▶ $self->{on_tick} = sub{} unless( defined( $self->{on_tick} ) );
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"on_tick"} 0 0 0
45 0 ▶ $self->{port} = 8080 unless( defined( $self->{port} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"port"} 0 0 0
46 0 ▶ $self->{silence_max} = 20 unless( defined( $self->{silence_max} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"silence_max"} 0 0 0
47 0 ▶ $self->{subprotocol} = [] unless( defined( $self->{subprotocol} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"subprotocol"} 0 0 0
48 0 ▶ $self->{tick_period} = 0 unless( defined( $self->{tick_period} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"tick_period"} 0 0 0
49 # Used by WebSocket::Connection when comparing the version of the client handshake with the one we support here
50 0 ▶ $self->{version} = WebSocket::Version->new( WEBSOCKET_DRAFT_VERSION_DEFAULT ) unless( defined( $self->{version} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"version"} 0 0 0
51 0 $self->{watch_readable} = {};
52 0 $self->{watch_writable} = {};
53 0 $self->{select_readable}= undef();
54 0 $self->{select_writable}= undef();
55 0 ▶ $self->{_exception_class} = 'WebSocket::Exception' unless( defined( $self->{_exception_class} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_exception_class"} 0 0 0
56 0 $self->{_init_strict_use_sub} = 1;
57 0 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 0 0 0
58 0 $self->{silence_checkinterval} = $self->{silence_max} / 2;
59 0 foreach my $watchtype ( qw( readable writable ) )
60 {
61 # Already setup because watch_readable or watch_writable was already passed as init parameters
62 0 ▶ next if( $self->{ "select_${watchtype}" } );
Branch: 1 branch
BranchTrueFalseTotal
if $$self{"select_$watchtype"} 0 0 0
63 0 $self->{ "select_${watchtype}" } = IO::Select->new;
64 0 my $key = "watch_${watchtype}";
65 # return( $self->error( "$class parameter '$key' expects an array reference containing an even number of elements" ) ) if( scalar( @{$self->{ $key }} ) );
66 # my @watch = @{$self->{ $key }};
67 0 $self->{ $key } = {};
68 # We watch_readable and watch_writable with default parameter
69 0 $self->_watch( $watchtype, [] );
70 }
71 # Connections
72 0 $self->{conns} = {};
73 0 $self->{socket} = undef;
74 0 return( $self );
75 }
76  
77 0 ▶sub connection_class { return( shift->_set_get_scalar( 'connection_class', @_ ) ); }
Subroutine connection_class: not called CC=1 SCAR=6.9
Pod documented
78  
79 sub connections
80 0 ▶{
Subroutine connections: not called CC=3 SCAR=24.8
Pod documented
81 0 my $self = shift( @_ );
82 0 my @conns = grep{ $_->is_ready } map{ $_->{conn} } values( %{$self->{conns}} );
83 0 ▶ if( want( 'LIST' ) || $self->legacy )
Branch: 1 branch
BranchTrueFalseTotal
if (want("LIST") or $self->legacy) 0 0 0
Condition0%0/3
want("LIST") or $self->legacy
l!l&&r!l&&!r
000
MC/DC0%0/2
want("LIST") or $self->legacy
want("LIST") $self->legacy
Truth table0%0/3
A or B
A= want("LIST")B= $self->legacy
ABresult
1X1
011
000
84 {
85 0 return( @conns );
86 }
87 0 return( $self->new_array( \@conns ) );
88 }
89  
90 sub disconnect
91 0 ▶{
Subroutine disconnect: not called CC=3 SCAR=24.8
Pod documented
92 0 my( $self, $fh ) = @_;
93 0 $self->{select_readable}->remove( $fh );
94 # We should shutdown to tell the other side of the TCP that we are done,
95 # then remove the filehandle
96 # <https://www.perlmonks.org/?node_id=108244>
97 $fh->shutdown(SHUT_RDWR) || do
98 0 ▶ {
Branch: 1 branch
BranchTrueFalseTotal
$fh->shutdown(2) or do { warn "Error shutting down the client socket: $!" if $self->_warnings_is_enabled } 0 0 0
99 0 ▶ warn( "Error shutting down the client socket: $!" ) if( $self->_warnings_is_enabled() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_warnings_is_enabled 0 0 0
100 };
101 0 $fh->close();
102 0 CORE::delete( $self->{conns}->{ $fh } );
103 }
104  
105 0 ▶sub extensions { return( shift->_set_get_object_array_object( 'extensions', 'WebSocket::Extension', @_ ) ); }
Subroutine extensions: not called CC=1 SCAR=6.9
Pod documented
106  
107 0 ▶sub ip { return( shift->_set_get_scalar_as_object( 'ip', @_ ) ); }
Subroutine ip: not called CC=1 SCAR=6.9
Pod documented
108  
109 0 ▶sub is_ssl { return( shift->_set_get_boolean( 'is_ssl', @_ ) ); }
Subroutine is_ssl: not called CC=1 SCAR=6.9
Pod documented
110  
111 0 ▶sub legacy { return( shift->_set_get_boolean( 'legacy', @_ ) ); }
Subroutine legacy: not called CC=1 SCAR=6.9
Pod documented
112  
113 0 ▶sub listen { return( shift->_set_get_object_without_init( 'listen', 'IO::Socket', @_ ) ); }
Subroutine listen: not called CC=1 SCAR=6.9
Pod documented
114
115 sub on
116 0 ▶{
Subroutine on: not called CC=5 SCAR=34.0
Pod documented
117 0 my $self = shift( @_ );
118 0 my $opts = $self->_get_args_as_hash( @_ );
119 0 ▶ while( my( $key, $value ) = each( %$opts ) )
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$opts) 0 0 0
120 {
121 0 ▶ return( $self->error( "Invalid event '$key'" ) ) if( !$self->can( "on_${key}" ) );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can("on_$key") 0 0 0
122 0 ▶ return( $self->error( "Expected a code reference for event '$key', but got '", overload::StrVal( $value ), "'." ) ) if( ref( $value ) ne 'CODE' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $value ne "CODE" 0 0 0
123 0 ▶ $self->$key( $value ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->$key($value) or return $self->pass_error 0 0 0
124 }
125 0 return( $self );
126 }
127  
128 0 ▶sub on_accept { return( shift->_set_get_code( 'on_accept', @_ ) ); }
Subroutine on_accept: not called CC=1 SCAR=6.9
Pod documented
129  
130 0 ▶sub on_connect { return( shift->_set_get_code( 'on_connect', @_ ) ); }
Subroutine on_connect: not called CC=1 SCAR=6.9
Pod documented
131  
132 0 ▶sub on_shutdown { return( shift->_set_get_code( 'on_shutdown', @_ ) ); }
Subroutine on_shutdown: not called CC=1 SCAR=6.9
Pod documented
133  
134 0 ▶sub on_tick { return( shift->_set_get_code( 'on_tick', @_ ) ); }
Subroutine on_tick: not called CC=1 SCAR=6.9
Pod documented
135  
136 0 ▶sub port { return( shift->_set_get_number( 'port', @_ ) ); }
Subroutine port: not called CC=1 SCAR=6.9
Pod documented
137  
138 sub shutdown
139 0 ▶{
Subroutine shutdown: not called CC=98 SCAR=90.7
Pod documented
140 0 my $self = shift( @_ );
141 0 ▶ my $shutdown_cb = $self->on_shutdown || sub{};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/3
$self->on_shutdown || sub { }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->on_shutdown || sub { }
$self->on_shutdown sub { }
Truth table0%0/3
A || B
A= $self->on_shutdownB= sub { }
ABresult
1X1
011
000
142
143 0 ▶ try
Subroutine __ANON__: not called CC=2 SCAR=17.9
Subroutine __ANON__: not called CC=17 SCAR=56.2
Branch: 3 branches
BranchTrueFalseTotal
unless defined $Nice::Try::NEED_TO_RETURN 0 0 0
if ($INC{"threads.pm"} and not exists $INC{"forks.pm"}) 0 0 0
wantarray ? : 0 0 0
Condition0%0/3
$INC{"threads.pm"} and not exists $INC{"forks.pm"}
!ll&&!rl&&r
000
MC/DC0%0/2
$INC{"threads.pm"} and not exists $INC{"forks.pm"}
$INC{"threads.pm"} not exists $INC{"forks.pm"}
Truth table0%0/3
A and not(B)
A= $INC{"threads.pm"}B= not exists $INC{"forks.pm"}
ABresult
0X0
100
111
144 0 {
145 0 $shutdown_cb->( $self );
146 }
147 0 ▶ catch( $e )
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=4 SCAR=29.0
Branch: 34 branches
BranchTrueFalseTotal
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
&$Nice::Try::TRY ? : 0 0 0
if scalar @Nice::Try::VOID 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
if defined $Nice::Try::LAST_VAL 0 0 0
length $@ ? : 0 0 0
unless builtin::blessed($@) 0 0 0
if ($Nice::Try::DIED) 0 0 0
if ($Nice::Try::HAS_CATCH) 0 0 0
if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL 0 0 0
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
Condition0%0/8
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
!ll
00
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/1
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
not defined $Nice::Try::WANTARRAY
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/2
not(A)
A= not defined $Nice::Try::WANTARRAY
Aresult
00
11
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
148 0 {
149 0 ▶ warn( "Error calling the shutdown callback: $e" ) if( $self->_warnings_is_enabled() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_warnings_is_enabled 0 0 0
150 0 return( $self->error({ code => WS_INTERNAL_SERVER_ERROR, message => "Internal error" }) );
151 0 ▶ }
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Branch: 56 branches
BranchTrueFalseTotal
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
&$Nice::Try::CATCH ? : 0 0 0
if scalar @Nice::Try::VOID 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
if $@ 0 0 0
if (defined $Nice::Try::CATCH_DIED) 0 0 0
if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { } 0 0 0
elsif (scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { } 0 0 0
if defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return" 0 0 0
if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return") 0 0 0
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { } 0 0 0
elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { } 0 0 0
elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { } 0 0 0
elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { } 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::WANTARRAY ? : 0 0 0
$Nice::Try::WANTARRAY ? : 0 0 0
scalar @Nice::Try::VOID > 1 ? : 0 0 0
if (defined $Nice::Try::BREAK) 0 0 0
if ($Nice::Try::BREAK eq 'next') { } 0 0 0
elsif ($Nice::Try::BREAK eq 'last') { } 0 0 0
elsif ($Nice::Try::BREAK eq 'redo') { } 0 0 0
scalar @Nice::Try::LAST_VAL > 1 ? : 0 0 0
if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL 0 0 0
Condition0%0/50
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq "return" and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
defined $Nice::Try::WANTARRAY or defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
l!l&&r!l&&!r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
not builtin::blessed($Nice::Try::RETVAL[0]) or builtin::blessed($Nice::Try::RETVAL[0]) and not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
l!l&&r!l&&!r
000
builtin::blessed($Nice::Try::RETVAL[0]) and not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return"
l!l&&r!l&&!r
000
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__NEXT__"
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__LAST__"
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__REDO__"
!ll&&!rl&&r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
not builtin::blessed($Nice::Try::VOID[0]) or builtin::blessed($Nice::Try::VOID[0]) and not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
l!l&&r!l&&!r
000
builtin::blessed($Nice::Try::VOID[0]) and not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
!ll
00
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/6
defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq "return" and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
defined $Nice::Try::WANTARRAY defined $Nice::Try::BREAK $Nice::Try::BREAK eq "return" not builtin::blessed($Nice::Try::RETVAL[0]) builtin::blessed($Nice::Try::RETVAL[0]) not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
MC/DC0%0/2
not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return"
not defined $Nice::Try::BREAK $Nice::Try::BREAK eq "return"
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__NEXT__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__NEXT__"
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__LAST__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__LAST__"
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__REDO__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__REDO__"
MC/DC0%0/4
scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
scalar @Nice::Try::VOID not builtin::blessed($Nice::Try::VOID[0]) builtin::blessed($Nice::Try::VOID[0]) not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
MC/DC0%0/1
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
not defined $Nice::Try::WANTARRAY
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/10
A or B and C and not(D) or E and not(F)
A= defined $Nice::Try::WANTARRAYB= defined $Nice::Try::BREAKC= $Nice::Try::BREAK eq "return"D= not builtin::blessed($Nice::Try::RETVAL[0])E= builtin::blessed($Nice::Try::RETVAL[0])F= not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
ABCDEFresult
00XXXX0
010XXX0
1XX00X0
1XX0100
01100X0
0110100
1XX1XX1
1XX0111
0111XX1
0110111
Truth table0%0/3
not(A) or B
A= not defined $Nice::Try::BREAKB= $Nice::Try::BREAK eq "return"
ABresult
1X1
011
000
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__NEXT__"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__LAST__"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__REDO__"
ABresult
0X0
100
111
Truth table0%0/5
A and not(B) or C and not(D)
A= scalar @Nice::Try::VOIDB= not builtin::blessed($Nice::Try::VOID[0])C= builtin::blessed($Nice::Try::VOID[0])D= not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
ABCDresult
0XXX0
100X0
10100
11XX1
10111
Truth table0%0/2
not(A)
A= not defined $Nice::Try::WANTARRAY
Aresult
00
11
152
153 0 ▶ my $socket = $self->listen || return( $self->error( "Cannot find the socket object!" ) );
Condition0%0/2
$self->listen || (return $self->error('Cannot find the socket object!'))
l!l
00
MC/DC0%0/1
$self->listen || (return $self->error('Cannot find the socket object!'))
$self->listen
Truth table0%0/2
A
A= $self->listen
Aresult
11
00
154 $self->connections->for(sub
155 0 ▶ {
Subroutine __ANON__: not called CC=1 SCAR=6.9
156 0 $_->disconnect( 1001 );
157 0 });
158 0 $self->{select_readable}->remove( $socket );
159 0 $socket->shutdown(2);
160 0 $socket->close();
161 0 return( $self );
162 }
163  
164 0 ▶sub silence_checkinterval { return( shift->_set_get_number( 'silence_checkinterval', @_ ) ); }
Subroutine silence_checkinterval: not called CC=1 SCAR=6.9
Pod documented
165  
166 0 ▶sub silence_max { return( shift->_set_get_number( 'silence_max', @_ ) ); }
Subroutine silence_max: not called CC=1 SCAR=6.9
Pod documented
167  
168 0 ▶sub socket { return( shift->_set_get_object_without_init( 'listen', 'IO::Socket', @_ ) ); }
Subroutine socket: not called CC=1 SCAR=6.9
Pod documented
169  
170 sub start
171 0 ▶{
Subroutine start: not called CC=328 SCAR=114.9
Pod documented
172 0 my $self = shift( @_ );
173 0 my $sock;
174 0 my $use_ssl = 0;
175 0 ▶ if( $self->_is_a( $self->listen, 'IO::Socket' ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_a($self->listen, 'IO::Socket')) { } 0 0 0
176 {
177 # if we got a server, make sure it's valid by clearing errors and checking errors anyway; if there's still an error, it's closed
178 0 $sock = $self->listen;
179 0 $sock->clearerr;
180 0 ▶ return( $self->error( "Failed to start websocket server; the TCP server provided via 'listen' is invalid. (is the listening socket is closed? are you trying to reuse a server that has already shut down?)" ) ) if( $sock->error );
Branch: 1 branch
BranchTrueFalseTotal
if $sock->error 0 0 0
181 0 ▶ $use_ssl = ( $sock->isa( 'IO::Socket::SSL' ) || $sock->can( 'accept_SSL' ) ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$sock->isa('IO::Socket::SSL') || $sock->can('accept_SSL') ? : 0 0 0
Condition0%0/3
$sock->isa("IO::Socket::SSL") or $sock->can("accept_SSL")
l!l&&r!l&&!r
000
MC/DC0%0/2
$sock->isa("IO::Socket::SSL") or $sock->can("accept_SSL")
$sock->isa("IO::Socket::SSL") $sock->can("accept_SSL")
Truth table0%0/3
A or B
A= $sock->isa("IO::Socket::SSL")B= $sock->can("accept_SSL")
ABresult
1X1
011
000
182 }
183 else
184 {
185 # if we merely got a port, set up a reasonable default tcp server
186 0 my $params =
187 {
188 Listen => 5,
189 Proto => 'tcp',
190 ReuseAddr => 1,
191 };
192 0 ▶ $params->{LocalPort} = $self->port->scalar if( $self->port );
Branch: 1 branch
BranchTrueFalseTotal
if $self->port 0 0 0
193 0 ▶ $sock = IO::Socket::INET->new( %$params ) ||
Condition0%0/2
'IO::Socket::INET'->new(%$params) || (return $self->error("Failed to listen on port $self->{'port'}: $!"))
l!l
00
MC/DC0%0/1
'IO::Socket::INET'->new(%$params) || (return $self->error("Failed to listen on port $self->{'port'}: $!"))
'IO::Socket::INET'->new(%$params)
Truth table0%0/2
A
A= 'IO::Socket::INET'->new(%$params)
Aresult
11
00
194 return( $self->error( "Failed to listen on port $self->{port}: $!" ) );
195 0 $self->listen( $sock );
196 0 ▶ if( !$self->port )
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->port) 0 0 0
197 {
198 0 $self->port( $sock->sockport );
199 }
200 }
201 0 $self->is_ssl( $use_ssl );
202 0 $self->ip( $sock->sockhost );
203  
204 0 $self->{select_readable}->add( $sock );
205  
206 0 $self->{conns} = {};
207 0 ▶ my $silence_nextcheck = $self->silence_max ? ( time() + $self->silence_checkinterval ) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->silence_max ? : 0 0 0
208 0 ▶ my $tick_next = $self->tick_period ? ( time() + $self->tick_period ) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->tick_period ? : 0 0 0
209 0 ▶ my $conn_class = $self->connection_class || 'WebSocket::Connection';
Condition0%0/2
$self->connection_class || 'WebSocket::Connection'
l!l
00
MC/DC0%0/1
$self->connection_class || 'WebSocket::Connection'
$self->connection_class
Truth table0%0/2
A
A= $self->connection_class
Aresult
11
00
210 0 ▶ $self->_load_class( $conn_class ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->_load_class($conn_class) or return $self->pass_error 0 0 0
211  
212 0 ▶ my $accept_cb = $self->on_accept || sub{};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/3
$self->on_accept || sub { }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->on_accept || sub { }
$self->on_accept sub { }
Truth table0%0/3
A || B
A= $self->on_acceptB= sub { }
ABresult
1X1
011
000
213 0 ▶ my $connect_cb = $self->on_connect || sub{};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/3
$self->on_connect || sub { }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->on_connect || sub { }
$self->on_connect sub { }
Truth table0%0/3
A || B
A= $self->on_connectB= sub { }
ABresult
1X1
011
000
214 0 ▶ my $tick_cb = $self->on_tick || sub{};
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/3
$self->on_tick || sub { }
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->on_tick || sub { }
$self->on_tick sub { }
Truth table0%0/3
A || B
A= $self->on_tickB= sub { }
ABresult
1X1
011
000
215 0 ▶ while( $sock->opened )
Branch: 1 branch
BranchTrueFalseTotal
if ($sock->opened) 0 0 0
216 {
217 0 ▶ my $silence_checktimeout = $self->silence_max ? ( $silence_nextcheck - time() ) : undef();
Branch: 1 branch
BranchTrueFalseTotal
$self->silence_max ? : 0 0 0
218 0 ▶ my $tick_timeout = $self->tick_period ? ( $tick_next - time() ) : undef();
Branch: 1 branch
BranchTrueFalseTotal
$self->tick_period ? : 0 0 0
219 0 my $timeout = List::Util::min( grep{ defined( $_ ) } ( $silence_checktimeout, $tick_timeout ) );
220  
221 my( $ready_read, $ready_write, undef() ) = IO::Select->select(
222 $self->{select_readable},
223 $self->{select_writable},
224 0 undef(),
225 $timeout
226 );
227 0 ▶ foreach my $fh ( $ready_read ? @$ready_read : () )
Branch: 1 branch
BranchTrueFalseTotal
$ready_read ? : 0 0 0
228 {
229 0 ▶ if( $fh == $sock )
Branch: 3 branches
BranchTrueFalseTotal
if ($fh == $sock) { } 0 0 0
elsif ($self->{'watch_readable'}{$fh}) { } 0 0 0
elsif ($self->{'conns'}{$fh}) { } 0 0 0
230 {
231 0 my $client = $sock->accept;
232 0 ▶ unless( $client )
Branch: 1 branch
BranchTrueFalseTotal
unless ($client) 0 0 0
233 {
234 0 ▶ warn( "Error accepting connection from client: $!" ) if( $self->_warnings_is_enabled() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_warnings_is_enabled 0 0 0
235 0 next;
236 }
237 # NOTE: Connection
238
239 0 my $conn;
240 0 ▶ if( defined( $accept_cb ) && ref( $accept_cb ) eq 'CODE' )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $accept_cb and ref $accept_cb eq "CODE") 0 0 0
Condition0%0/3
defined $accept_cb and ref $accept_cb eq "CODE"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $accept_cb and ref $accept_cb eq "CODE"
defined $accept_cb ref $accept_cb eq "CODE"
Truth table0%0/3
A and B
A= defined $accept_cbB= ref $accept_cb eq "CODE"
ABresult
0X0
100
111
241 {
242 0 ▶ try
Subroutine __ANON__: not called CC=2 SCAR=17.9
Subroutine __ANON__: not called CC=17 SCAR=56.2
Branch: 3 branches
BranchTrueFalseTotal
unless defined $Nice::Try::NEED_TO_RETURN 0 0 0
if ($INC{"threads.pm"} and not exists $INC{"forks.pm"}) 0 0 0
wantarray ? : 0 0 0
Condition0%0/3
$INC{"threads.pm"} and not exists $INC{"forks.pm"}
!ll&&!rl&&r
000
MC/DC0%0/2
$INC{"threads.pm"} and not exists $INC{"forks.pm"}
$INC{"threads.pm"} not exists $INC{"forks.pm"}
Truth table0%0/3
A and not(B)
A= $INC{"threads.pm"}B= not exists $INC{"forks.pm"}
ABresult
0X0
100
111
243 0 {
244 0 $conn = $accept_cb->({
245 socket => $client,
246 server => $self,
247 subprotocol => $self->subprotocol,
248 });
249 }
250 0 ▶ catch( $e )
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=3 SCAR=23.9
Branch: 34 branches
BranchTrueFalseTotal
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
&$Nice::Try::TRY ? : 0 0 0
if scalar @Nice::Try::VOID 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
if defined $Nice::Try::LAST_VAL 0 0 0
length $@ ? : 0 0 0
unless builtin::blessed($@) 0 0 0
if ($Nice::Try::DIED) 0 0 0
if ($Nice::Try::HAS_CATCH) 0 0 0
if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL 0 0 0
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
Condition0%0/8
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
!ll
00
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/1
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
not defined $Nice::Try::WANTARRAY
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/2
not(A)
A= not defined $Nice::Try::WANTARRAY
Aresult
00
11
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
251 0 {
252 0 return( $self->error( "Error calling the accept callback: $e" ) );
253 0 ▶ }
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Branch: 56 branches
BranchTrueFalseTotal
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
&$Nice::Try::CATCH ? : 0 0 0
if scalar @Nice::Try::VOID 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
if $@ 0 0 0
if (defined $Nice::Try::CATCH_DIED) 0 0 0
if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { } 0 0 0
elsif (scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { } 0 0 0
if defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return" 0 0 0
if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return") 0 0 0
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { } 0 0 0
elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { } 0 0 0
elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { } 0 0 0
elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { } 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::WANTARRAY ? : 0 0 0
$Nice::Try::WANTARRAY ? : 0 0 0
scalar @Nice::Try::VOID > 1 ? : 0 0 0
if (defined $Nice::Try::BREAK) 0 0 0
if ($Nice::Try::BREAK eq 'next') { } 0 0 0
elsif ($Nice::Try::BREAK eq 'last') { } 0 0 0
elsif ($Nice::Try::BREAK eq 'redo') { } 0 0 0
scalar @Nice::Try::LAST_VAL > 1 ? : 0 0 0
if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL 0 0 0
Condition0%0/50
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq "return" and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
defined $Nice::Try::WANTARRAY or defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
l!l&&r!l&&!r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
not builtin::blessed($Nice::Try::RETVAL[0]) or builtin::blessed($Nice::Try::RETVAL[0]) and not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
l!l&&r!l&&!r
000
builtin::blessed($Nice::Try::RETVAL[0]) and not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return"
l!l&&r!l&&!r
000
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__NEXT__"
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__LAST__"
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__REDO__"
!ll&&!rl&&r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
not builtin::blessed($Nice::Try::VOID[0]) or builtin::blessed($Nice::Try::VOID[0]) and not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
l!l&&r!l&&!r
000
builtin::blessed($Nice::Try::VOID[0]) and not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
!ll
00
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/6
defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq "return" and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
defined $Nice::Try::WANTARRAY defined $Nice::Try::BREAK $Nice::Try::BREAK eq "return" not builtin::blessed($Nice::Try::RETVAL[0]) builtin::blessed($Nice::Try::RETVAL[0]) not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
MC/DC0%0/2
not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return"
not defined $Nice::Try::BREAK $Nice::Try::BREAK eq "return"
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__NEXT__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__NEXT__"
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__LAST__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__LAST__"
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__REDO__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__REDO__"
MC/DC0%0/4
scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
scalar @Nice::Try::VOID not builtin::blessed($Nice::Try::VOID[0]) builtin::blessed($Nice::Try::VOID[0]) not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
MC/DC0%0/1
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
not defined $Nice::Try::WANTARRAY
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/10
A or B and C and not(D) or E and not(F)
A= defined $Nice::Try::WANTARRAYB= defined $Nice::Try::BREAKC= $Nice::Try::BREAK eq "return"D= not builtin::blessed($Nice::Try::RETVAL[0])E= builtin::blessed($Nice::Try::RETVAL[0])F= not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
ABCDEFresult
00XXXX0
010XXX0
1XX00X0
1XX0100
01100X0
0110100
1XX1XX1
1XX0111
0111XX1
0110111
Truth table0%0/3
not(A) or B
A= not defined $Nice::Try::BREAKB= $Nice::Try::BREAK eq "return"
ABresult
1X1
011
000
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__NEXT__"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__LAST__"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__REDO__"
ABresult
0X0
100
111
Truth table0%0/5
A and not(B) or C and not(D)
A= scalar @Nice::Try::VOIDB= not builtin::blessed($Nice::Try::VOID[0])C= builtin::blessed($Nice::Try::VOID[0])D= not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
ABCDresult
0XXX0
100X0
10100
11XX1
10111
Truth table0%0/2
not(A)
A= not defined $Nice::Try::WANTARRAY
Aresult
00
11
254 }
255
256 0 ▶ unless( $self->_is_object( $conn ) && $self->_can( $conn => [qw( error is_ready new recv send )] ) )
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_is_object($conn) and $self->_can($conn, ["error", "is_ready", "new", "recv", "send"])) 0 0 0
Condition0%0/3
$self->_is_object($conn) and $self->_can($conn, ["error", "is_ready", "new", "recv", "send"])
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($conn) and $self->_can($conn, ["error", "is_ready", "new", "recv", "send"])
$self->_is_object($conn) $self->_can($conn, ["error", "is_ready", "new", "recv", "send"])
Truth table0%0/3
A and B
A= $self->_is_object($conn)B= $self->_can($conn, ["error", "is_ready", "new", "recv", "send"])
ABresult
0X0
100
111
257 {
258 0 $conn = $conn_class->new(
259 socket => $client,
260 server => $self,
261 subprotocol => $self->subprotocol,
262 debug => $self->debug,
263 );
264 }
265 0 $self->{conns}->{ $client } = { conn => $conn, lastrecv => time() };
266 0 $self->{select_readable}->add( $client );
267
268 0 ▶ try
Subroutine __ANON__: not called CC=2 SCAR=17.9
Subroutine __ANON__: not called CC=21 SCAR=60.4
Branch: 3 branches
BranchTrueFalseTotal
unless defined $Nice::Try::NEED_TO_RETURN 0 0 0
if ($INC{"threads.pm"} and not exists $INC{"forks.pm"}) 0 0 0
wantarray ? : 0 0 0
Condition0%0/3
$INC{"threads.pm"} and not exists $INC{"forks.pm"}
!ll&&!rl&&r
000
MC/DC0%0/2
$INC{"threads.pm"} and not exists $INC{"forks.pm"}
$INC{"threads.pm"} not exists $INC{"forks.pm"}
Truth table0%0/3
A and not(B)
A= $INC{"threads.pm"}B= not exists $INC{"forks.pm"}
ABresult
0X0
100
111
269 0 {
270 0 my $rv = $connect_cb->( $self, $conn );
271 # The callback returned a defined, but false value, so we terminate the connection
272 0 ▶ if( defined( $rv ) && !$rv )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $rv and not $rv) 0 0 0
Condition0%0/3
defined $rv and not $rv
!ll&&!rl&&r
000
MC/DC0%0/2
defined $rv and not $rv
defined $rv not $rv
Truth table0%0/3
A and not(B)
A= defined $rvB= not $rv
ABresult
0X0
100
111
273 {
274 0 $self->{select_readable}->remove( $fh );
275 0 CORE::delete( $self->{conns}->{ $client } );
276 $client->shutdown(SHUT_RDWR) || do
277 0 ▶ {
Branch: 1 branch
BranchTrueFalseTotal
$client->shutdown(2) or do { warn "Error closing client socket after being refused by connect callback: $!" if $self->_warnings_is_enabled } 0 0 0
278 0 ▶ warn( "Error closing client socket after being refused by connect callback: $!" ) if( $self->_warnings_is_enabled() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_warnings_is_enabled 0 0 0
279 };
280 0 close( $fh );
281 }
282 }
283 0 ▶ catch( $e )
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=3 SCAR=23.9
Branch: 34 branches
BranchTrueFalseTotal
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
&$Nice::Try::TRY ? : 0 0 0
if scalar @Nice::Try::VOID 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
if defined $Nice::Try::LAST_VAL 0 0 0
length $@ ? : 0 0 0
unless builtin::blessed($@) 0 0 0
if ($Nice::Try::DIED) 0 0 0
if ($Nice::Try::HAS_CATCH) 0 0 0
if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL 0 0 0
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
Condition0%0/8
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
!ll
00
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/1
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
not defined $Nice::Try::WANTARRAY
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/2
not(A)
A= not defined $Nice::Try::WANTARRAY
Aresult
00
11
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
284 0 {
285 0 return( $self->error( "Error calling the connect callback: $e" ) );
286 0 ▶ }
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Branch: 56 branches
BranchTrueFalseTotal
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
&$Nice::Try::CATCH ? : 0 0 0
if scalar @Nice::Try::VOID 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
if $@ 0 0 0
if (defined $Nice::Try::CATCH_DIED) 0 0 0
if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { } 0 0 0
elsif (scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { } 0 0 0
if defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return" 0 0 0
if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return") 0 0 0
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { } 0 0 0
elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { } 0 0 0
elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { } 0 0 0
elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { } 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::WANTARRAY ? : 0 0 0
$Nice::Try::WANTARRAY ? : 0 0 0
scalar @Nice::Try::VOID > 1 ? : 0 0 0
if (defined $Nice::Try::BREAK) 0 0 0
if ($Nice::Try::BREAK eq 'next') { } 0 0 0
elsif ($Nice::Try::BREAK eq 'last') { } 0 0 0
elsif ($Nice::Try::BREAK eq 'redo') { } 0 0 0
scalar @Nice::Try::LAST_VAL > 1 ? : 0 0 0
if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL 0 0 0
Condition0%0/50
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq "return" and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
defined $Nice::Try::WANTARRAY or defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
l!l&&r!l&&!r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
not builtin::blessed($Nice::Try::RETVAL[0]) or builtin::blessed($Nice::Try::RETVAL[0]) and not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
l!l&&r!l&&!r
000
builtin::blessed($Nice::Try::RETVAL[0]) and not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return"
l!l&&r!l&&!r
000
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__NEXT__"
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__LAST__"
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__REDO__"
!ll&&!rl&&r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
not builtin::blessed($Nice::Try::VOID[0]) or builtin::blessed($Nice::Try::VOID[0]) and not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
l!l&&r!l&&!r
000
builtin::blessed($Nice::Try::VOID[0]) and not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
!ll
00
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/6
defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq "return" and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
defined $Nice::Try::WANTARRAY defined $Nice::Try::BREAK $Nice::Try::BREAK eq "return" not builtin::blessed($Nice::Try::RETVAL[0]) builtin::blessed($Nice::Try::RETVAL[0]) not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
MC/DC0%0/2
not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return"
not defined $Nice::Try::BREAK $Nice::Try::BREAK eq "return"
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__NEXT__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__NEXT__"
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__LAST__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__LAST__"
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__REDO__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__REDO__"
MC/DC0%0/4
scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
scalar @Nice::Try::VOID not builtin::blessed($Nice::Try::VOID[0]) builtin::blessed($Nice::Try::VOID[0]) not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
MC/DC0%0/1
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
not defined $Nice::Try::WANTARRAY
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/10
A or B and C and not(D) or E and not(F)
A= defined $Nice::Try::WANTARRAYB= defined $Nice::Try::BREAKC= $Nice::Try::BREAK eq "return"D= not builtin::blessed($Nice::Try::RETVAL[0])E= builtin::blessed($Nice::Try::RETVAL[0])F= not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
ABCDEFresult
00XXXX0
010XXX0
1XX00X0
1XX0100
01100X0
0110100
1XX1XX1
1XX0111
0111XX1
0110111
Truth table0%0/3
not(A) or B
A= not defined $Nice::Try::BREAKB= $Nice::Try::BREAK eq "return"
ABresult
1X1
011
000
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__NEXT__"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__LAST__"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__REDO__"
ABresult
0X0
100
111
Truth table0%0/5
A and not(B) or C and not(D)
A= scalar @Nice::Try::VOIDB= not builtin::blessed($Nice::Try::VOID[0])C= builtin::blessed($Nice::Try::VOID[0])D= not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
ABCDresult
0XXX0
100X0
10100
11XX1
10111
Truth table0%0/2
not(A)
A= not defined $Nice::Try::WANTARRAY
Aresult
00
11
287 }
288 elsif( $self->{watch_readable}->{ $fh } )
289 {
290 0 $self->{watch_readable}->{ $fh }->{cb}->( $self, $fh );
291 }
292 elsif( $self->{conns}->{ $fh } )
293 {
294 0 my $def = $self->{conns}->{ $fh };
295 0 $def->{lastrecv} = time;
296 0 my $rv = $def->{conn}->recv();
297 0 ▶ if( !defined( $rv ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $rv) 0 0 0
298 {
299 0 $self->{select_readable}->remove( $fh );
300 0 CORE::delete( $self->{conns}->{ $fh } );
301 $fh->shutdown(SHUT_RDWR) || do
302 0 ▶ {
Branch: 1 branch
BranchTrueFalseTotal
$fh->shutdown(2) or do { warn "Error closing client socket after being refused by connect callback: $!" if $self->_warnings_is_enabled } 0 0 0
303 0 ▶ warn( "Error closing client socket after being refused by connect callback: $!" ) if( $self->_warnings_is_enabled() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_warnings_is_enabled 0 0 0
304 };
305 0 close( $fh );
306 }
307 }
308 else
309 {
310 0 ▶ warn( "Filehandle $fh became readable, but no handler took responsibility for it; removing it\n" ) if( $self->_warnings_is_enabled() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_warnings_is_enabled 0 0 0
311 0 $self->{select_readable}->remove( $fh );
312 }
313 }
314  
315 0 ▶ foreach my $fh ( $ready_write ? @$ready_write : () )
Branch: 1 branch
BranchTrueFalseTotal
$ready_write ? : 0 0 0
316 {
317 0 ▶ if( $self->{watch_writable}->{ $fh } )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'watch_writable'}{$fh}) { } 0 0 0
318 {
319 0 $self->{watch_writable}->{ $fh }->{cb}->( $self, $fh );
320 }
321 else
322 {
323 0 ▶ warn( "Filehandle $fh became writable, but no handler took responsibility for it; removing it\n" ) if( $self->_warnings_is_enabled() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_warnings_is_enabled 0 0 0
324 0 $self->{select_writable}->remove( $fh );
325 }
326 }
327  
328 0 ▶ if( $self->silence_max )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->silence_max) 0 0 0
329 {
330 0 my $now = time();
331 0 ▶ if( $silence_nextcheck < $now )
Branch: 1 branch
BranchTrueFalseTotal
if ($silence_nextcheck < $now) 0 0 0
332 {
333 0 my $lastcheck = $silence_nextcheck - $self->silence_checkinterval;
334 0 ▶ $_->{conn}->send( 'ping' ) for grep { $_->{conn}->is_ready && $_->{lastrecv} < $lastcheck } values %{$self->{conns}};
Condition0%0/3
$_->{'conn'}->is_ready && $_->{'lastrecv'} < $lastcheck
!ll&&!rl&&r
000
MC/DC0%0/2
$_->{'conn'}->is_ready && $_->{'lastrecv'} < $lastcheck
$_->{'conn'}->is_ready $_->{'lastrecv'} < $lastcheck
Truth table0%0/3
A && B
A= $_->{'conn'}->is_readyB= $_->{'lastrecv'} < $lastcheck
ABresult
0X0
100
111
335 0 $silence_nextcheck = $now + $self->silence_checkinterval;
336 }
337 }
338  
339 0 ▶ if( $self->tick_period && $tick_next < time() )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->tick_period and $tick_next < time) 0 0 0
Condition0%0/3
$self->tick_period and $tick_next < time
!ll&&!rl&&r
000
MC/DC0%0/2
$self->tick_period and $tick_next < time
$self->tick_period $tick_next < time
Truth table0%0/3
A and B
A= $self->tick_periodB= $tick_next < time
ABresult
0X0
100
111
340 {
341 0 ▶ try
Subroutine __ANON__: not called CC=2 SCAR=17.9
Subroutine __ANON__: not called CC=17 SCAR=56.2
Branch: 3 branches
BranchTrueFalseTotal
unless defined $Nice::Try::NEED_TO_RETURN 0 0 0
if ($INC{"threads.pm"} and not exists $INC{"forks.pm"}) 0 0 0
wantarray ? : 0 0 0
Condition0%0/3
$INC{"threads.pm"} and not exists $INC{"forks.pm"}
!ll&&!rl&&r
000
MC/DC0%0/2
$INC{"threads.pm"} and not exists $INC{"forks.pm"}
$INC{"threads.pm"} not exists $INC{"forks.pm"}
Truth table0%0/3
A and not(B)
A= $INC{"threads.pm"}B= not exists $INC{"forks.pm"}
ABresult
0X0
100
111
342 0 {
343 0 $tick_cb->( $self );
344 }
345 0 ▶ catch( $e )
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=1 SCAR=6.3
Subroutine __ANON__: not called CC=3 SCAR=23.9
Branch: 34 branches
BranchTrueFalseTotal
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
&$Nice::Try::TRY ? : 0 0 0
if scalar @Nice::Try::VOID 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
if defined $Nice::Try::LAST_VAL 0 0 0
length $@ ? : 0 0 0
unless builtin::blessed($@) 0 0 0
if ($Nice::Try::DIED) 0 0 0
if ($Nice::Try::HAS_CATCH) 0 0 0
if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL 0 0 0
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
Condition0%0/8
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
!ll
00
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/1
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
not defined $Nice::Try::WANTARRAY
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/2
not(A)
A= not defined $Nice::Try::WANTARRAY
Aresult
00
11
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
346 0 {
347 0 return( $self->error( "Error calling the tick callback: $e" ) );
348 0 ▶ }
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Subroutine BEGIN: called CC=1 SCAR=6.3
Branch: 56 branches
BranchTrueFalseTotal
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
elsif ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
&$Nice::Try::CATCH ? : 0 0 0
if scalar @Nice::Try::VOID 0 0 0
if ($Nice::Try::WANTARRAY) { } 0 0 0
elsif (defined $Nice::Try::WANTARRAY) { } 0 0 0
if $@ 0 0 0
if (defined $Nice::Try::CATCH_DIED) 0 0 0
if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { } 0 0 0
elsif (scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { } 0 0 0
if defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return" 0 0 0
if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return") 0 0 0
if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { } 0 0 0
if ($Nice::Try::WANT eq 'LIST') { } 0 0 0
elsif ($Nice::Try::WANT eq 'VOID') { } 0 0 0
elsif ($Nice::Try::WANT eq 'OBJECT') { } 0 0 0
elsif ($Nice::Try::WANT eq 'REFSCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'SCALAR') { } 0 0 0
elsif ($Nice::Try::WANT eq 'BOOLEAN') { } 0 0 0
elsif ($Nice::Try::WANT eq 'CODE') { } 0 0 0
elsif ($Nice::Try::WANT eq 'HASH') { } 0 0 0
elsif ($Nice::Try::WANT eq 'ARRAY') { } 0 0 0
elsif ($Nice::Try::WANT eq 'GLOB') { } 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { } 0 0 0
elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { } 0 0 0
elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { } 0 0 0
elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { } 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::NEED_TO_RETURN ? : 0 0 0
$Nice::Try::WANTARRAY ? : 0 0 0
$Nice::Try::WANTARRAY ? : 0 0 0
scalar @Nice::Try::VOID > 1 ? : 0 0 0
if (defined $Nice::Try::BREAK) 0 0 0
if ($Nice::Try::BREAK eq 'next') { } 0 0 0
elsif ($Nice::Try::BREAK eq 'last') { } 0 0 0
elsif ($Nice::Try::BREAK eq 'redo') { } 0 0 0
scalar @Nice::Try::LAST_VAL > 1 ? : 0 0 0
if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL 0 0 0
Condition0%0/50
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq "return" and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
defined $Nice::Try::WANTARRAY or defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
l!l&&r!l&&!r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
not builtin::blessed($Nice::Try::RETVAL[0]) or builtin::blessed($Nice::Try::RETVAL[0]) and not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
l!l&&r!l&&!r
000
builtin::blessed($Nice::Try::RETVAL[0]) and not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return"
l!l&&r!l&&!r
000
defined $Nice::Try::WANT and length $Nice::Try::WANT
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__NEXT__"
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__LAST__"
!ll&&!rl&&r
000
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__REDO__"
!ll&&!rl&&r
000
defined $Nice::Try::BREAK and $Nice::Try::BREAK eq "return"
!ll&&!rl&&r
000
scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
not builtin::blessed($Nice::Try::VOID[0]) or builtin::blessed($Nice::Try::VOID[0]) and not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
l!l&&r!l&&!r
000
builtin::blessed($Nice::Try::VOID[0]) and not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
!ll&&!rl&&r
000
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
!ll
00
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/6
defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq "return" and !builtin::blessed($Nice::Try::RETVAL[0]) || builtin::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
defined $Nice::Try::WANTARRAY defined $Nice::Try::BREAK $Nice::Try::BREAK eq "return" not builtin::blessed($Nice::Try::RETVAL[0]) builtin::blessed($Nice::Try::RETVAL[0]) not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
MC/DC0%0/2
not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return"
not defined $Nice::Try::BREAK $Nice::Try::BREAK eq "return"
MC/DC0%0/2
defined $Nice::Try::WANT and length $Nice::Try::WANT
defined $Nice::Try::WANT length $Nice::Try::WANT
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__NEXT__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__NEXT__"
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__LAST__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__LAST__"
MC/DC0%0/2
defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq "__REDO__"
defined $Nice::Try::RETVAL[0] $Nice::Try::RETVAL[0] eq "__REDO__"
MC/DC0%0/4
scalar @Nice::Try::VOID and !builtin::blessed($Nice::Try::VOID[0]) || builtin::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
scalar @Nice::Try::VOID not builtin::blessed($Nice::Try::VOID[0]) builtin::blessed($Nice::Try::VOID[0]) not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
MC/DC0%0/1
not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
not defined $Nice::Try::WANTARRAY
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/10
A or B and C and not(D) or E and not(F)
A= defined $Nice::Try::WANTARRAYB= defined $Nice::Try::BREAKC= $Nice::Try::BREAK eq "return"D= not builtin::blessed($Nice::Try::RETVAL[0])E= builtin::blessed($Nice::Try::RETVAL[0])F= not $Nice::Try::RETVAL[0]->isa("Nice::Try::SENTINEL")
ABCDEFresult
00XXXX0
010XXX0
1XX00X0
1XX0100
01100X0
0110100
1XX1XX1
1XX0111
0111XX1
0110111
Truth table0%0/3
not(A) or B
A= not defined $Nice::Try::BREAKB= $Nice::Try::BREAK eq "return"
ABresult
1X1
011
000
Truth table0%0/3
A and B
A= defined $Nice::Try::WANTB= length $Nice::Try::WANT
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__NEXT__"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__LAST__"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $Nice::Try::RETVAL[0]B= $Nice::Try::RETVAL[0] eq "__REDO__"
ABresult
0X0
100
111
Truth table0%0/5
A and not(B) or C and not(D)
A= scalar @Nice::Try::VOIDB= not builtin::blessed($Nice::Try::VOID[0])C= builtin::blessed($Nice::Try::VOID[0])D= not $Nice::Try::VOID[0]->isa("Nice::Try::SENTINEL")
ABCDresult
0XXX0
100X0
10100
11XX1
10111
Truth table0%0/2
not(A)
A= not defined $Nice::Try::WANTARRAY
Aresult
00
11
349
350 0 $tick_next += $self->tick_period;
351 }
352 }
353 0 return( $self );
354 }
355  
356 0 ▶sub stop { return( shift->shutdown( @_ ) ); }
Subroutine stop: not called CC=1 SCAR=6.9
Pod documented
357  
358 sub subprotocol
359 0 ▶{
Subroutine subprotocol: not called CC=8 SCAR=42.8
Pod documented
360 0 my $self = shift( @_ );
361 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
362 {
363 0 ▶ my $ref = $self->_is_array( $_[0] )
Branch: 4 branches
BranchTrueFalseTotal
$self->_is_array($_[0]) ? : 0 0 0
@_ == 1 ? : 0 0 0
$self->_is_object($_[0]) && overload::Method($_[0], '""') ? : 0 0 0
ref $_[0] ? : 0 0 0
Condition0%0/3
$self->_is_object($_[0]) and overload::Method($_[0], "\"\"")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($_[0]) and overload::Method($_[0], "\"\"")
$self->_is_object($_[0]) overload::Method($_[0], "\"\"")
Truth table0%0/3
A and B
A= $self->_is_object($_[0])B= overload::Method($_[0], "\"\"")
ABresult
0X0
100
111
364 ? shift( @_ )
365 : @_ == 1
366 ? ( $self->_is_object( $_[0] ) && overload::Method( $_[0], '""' ) )
367 ? [CORE::split( /[[:blank:]\h]+/, "$_[0]" )]
368 : ref( $_[0] )
369 ? shift( @_ )
370 : [CORE::split( /[[:blank:]\h]+/, $_[0] )]
371 : [@_];
372 0 ▶ $self->_set_get_array_as_object( 'subprotocol', $ref ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->_set_get_array_as_object("subprotocol", $ref) or return $self->pass_error 0 0 0
373 }
374 0 return( $self->_set_get_array_as_object( 'subprotocol' ) );
375 }
376  
377 0 ▶sub tick_period { return( shift->_set_get_number( 'tick_period', @_ ) ); }
Subroutine tick_period: not called CC=1 SCAR=6.9
Pod documented
378  
379 sub unwatch_readable
380 0 ▶{
Subroutine unwatch_readable: not called CC=1 SCAR=6.9
Pod documented
381 0 my $self = shift( @_ );
382 0 return( $self->_unwatch( readable => @_) );
383 }
384  
385 sub unwatch_writable
386 0 ▶{
Subroutine unwatch_writable: not called CC=1 SCAR=6.9
Pod documented
387 0 my $self = shift( @_ );
388 0 return( $self->_unwatch( writable => @_ ) );
389 }
390  
391 # Server response version header can contain one or more versions
392 sub version
393 0 ▶{
Subroutine version: not called CC=5 SCAR=34.0
Pod documented
394 0 my $self = shift( @_ );
395 # When setting value, we use an array object of WebSocket::Version objects
396 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
397 {
398 0 my $v = shift( @_ );
399 0 ▶ if( !ref( $v ) || ( $self->_is_object( $v ) && overload::Method( $v, '""' ) ) )
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $v or $self->_is_object($v) and overload::Method($v, "\"\"")) 0 0 0
Condition0%0/6
not ref $v or $self->_is_object($v) and overload::Method($v, "\"\"")
l!l&&r!l&&!r
000
$self->_is_object($v) and overload::Method($v, "\"\"")
!ll&&!rl&&r
000
MC/DC0%0/3
not ref $v or $self->_is_object($v) and overload::Method($v, "\"\"")
not ref $v $self->_is_object($v) overload::Method($v, "\"\"")
Truth table0%0/4
not(A) or B and C
A= not ref $vB= $self->_is_object($v)C= overload::Method($v, "\"\"")
ABCresult
1XX1
0111
00X0
0100
400 {
401 0 $v = [split( /[[:blank:]\h]*\,[[:blank:]\h]*/, "$v" )];
402 }
403 0 $self->_set_get_object_array_object( 'version', 'WebSocket::Version', $v );
404 }
405 0 return( $self->_set_get_object_array_object( 'version', 'WebSocket::Version' )->first );
406 }
407  
408 0 ▶sub versions { return( shift->_set_get_object_array_object( 'version', 'WebSocket::Version', @_ ) ); }
Subroutine versions: not called CC=1 SCAR=6.9
Pod documented
409  
410 sub watch_readable
411 0 ▶{
Subroutine watch_readable: not called CC=3 SCAR=24.8
Pod documented
412 0 my $self = shift( @_ );
413 0 my $args = $self->_get_args_as_array( @_ );
414 0 ▶ return( $self->error( "watch_readable expects an even number of arguments" ) ) if( @$args % 2 );
Branch: 1 branch
BranchTrueFalseTotal
if @$args % 2 0 0 0
415 0 ▶ $self->{select_readable} ||= IO::Select->new;
Condition0%0/3
$self->{"select_readable"} ||= "IO::Select"->new
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"select_readable"} ||= "IO::Select"->new
$self->{"select_readable"} "IO::Select"->new
Truth table0%0/3
A ||= B
A= $self->{"select_readable"}B= "IO::Select"->new
ABresult
1X1
011
000
416 0 return( $self->_watch( readable => @$args ) );
417 }
418  
419 sub watch_writable
420 0 ▶{
Subroutine watch_writable: not called CC=3 SCAR=24.8
Pod documented
421 0 my $self = shift( @_ );
422 0 my $args = $self->_get_args_as_array( @_ );
423 0 ▶ return( $self->error( "watch_writable expects an even number of arguments" ) ) if( @$args % 2 );
Branch: 1 branch
BranchTrueFalseTotal
if @$args % 2 0 0 0
424 0 ▶ $self->{select_writable} ||= IO::Select->new;
Condition0%0/3
$self->{"select_writable"} ||= "IO::Select"->new
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"select_writable"} ||= "IO::Select"->new
$self->{"select_writable"} "IO::Select"->new
Truth table0%0/3
A ||= B
A= $self->{"select_writable"}B= "IO::Select"->new
ABresult
1X1
011
000
425 0 return( $self->_watch( writable => @$args ) );
426 }
427  
428 sub watched_readable
429 0 ▶{
Subroutine watched_readable: not called CC=2 SCAR=17.9
Pod documented
430 0 my $self = shift( @_ );
431 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
432 {
433 0 my $fh = shift( @_ );
434 0 return( $self->{watch_readable}->{ $fh }->{cb} );
435 }
436 0 return( map{ $_->{fh}, $_->{cb} } values( %{$self->{watch_readable}} ) );
437 }
438  
439 sub watched_writable
440 0 ▶{
Subroutine watched_writable: not called CC=2 SCAR=17.9
Pod documented
441 0 my $self = shift( @_ );
442 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
443 {
444 0 my $fh = shift( @_ );
445 0 return( $self->{watch_writable}->{ $fh }->{cb} );
446 }
447 0 return( map{ $_->{fh}, $_->{cb} } values( %{$self->{watch_writable}} ) );
448 }
449  
450 sub _unwatch
451 0 ▶{
Subroutine _unwatch: not called CC=2 SCAR=17.9
452 0 my $self = shift( @_ );
453 0 my $type = shift( @_ );
454 0 foreach my $fh ( @_ )
455 {
456 0 $self->{ "select_${type}" }->remove( $fh );
457 0 CORE::delete( $self->{ "watch_${type}" }->{ $fh } );
458 }
459 0 return( $self );
460 }
461  
462 sub _watch
463 0 ▶{
Subroutine _watch: not called CC=7 SCAR=40.3
464 0 my $self = shift( @_ );
465 0 my $type = shift( @_ );
466 0 my $args = $self->_get_args_as_array( @_ );
467 0 ▶ return( $self->error( "watch_${type} expects an even number of arguments after the type" ) ) if( @$args % 2 );
Branch: 1 branch
BranchTrueFalseTotal
if @$args % 2 0 0 0
468 0 ▶ for( my $i = 0; $i < @$args; $i += 2 )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @$args) 0 0 0
469 {
470 0 my( $fh, $cb ) = ( $args->[ $i ], $args->[ $i + 1 ] );
471 0 ▶ return( $self->error( "watch_${type} expects the second value of each pair to be a code reference, but element $i was not" ) ) if( ref( $cb ) ne 'CODE' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $cb ne "CODE" 0 0 0
472 0 ▶ if( $self->{ "watch_${type}" }->{ $fh } )
Branch: 1 branch
BranchTrueFalseTotal
if ($$self{"watch_$type"}{$fh}) 0 0 0
473 {
474 0 ▶ warn( "watch_${type} was given a filehandle at index $i which is already being watched; ignoring!" ) if( $self->_warnings_is_enabled() );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_warnings_is_enabled 0 0 0
475 0 next;
476 }
477 0 $self->{ "select_${type}" }->add( $fh );
478 0 ▶ $self->{ "watch_${type}" } = {} unless( ref( $self->{ "watch_${type}" } ) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $$self{"watch_$type"} eq "HASH" 0 0 0
479 0 $self->{ "watch_${type}" }->{ $fh } = { fh => $fh, cb => $cb };
480 }
481 0 return( $self );
482 }
483  
484 2 1;
485 # NOTE: POD
486 __END__
« WebSocket/Client.pm ↑ Summary WebSocket/Headers.pm »