Branch Coverage

blib/lib/Net/MQTT/Simple.pm
Criterion Covered Total %
branch 7 132 5.3


line true false branch
24 0 0 eval { do { require IO::Socket::INET; 1 } } ? :
2 0 eval { do { require IO::Socket::IP; 1 } } ? :
42 20 535 if $filter eq "#"
43 17 518 if $filter eq "/#"
57 0 2 unless @_ <= 2
59 2 0 unless $server
70 0 0 unless @_ == 2 or @_ == 3
75 0 0 if $server =~ /:.*:/ and not $server =~ /\[/
78 0 0 if not $server =~ /:/ or $server =~ /^\[.*\]$/
95 0 0 if $self->{'will'}
97 0 0 if @_ > 4
99 0 0 if (@_ >= 2)
100 0 0 if (not defined $topic || defined $message) { }
111 0 0 unless length $self->{'will'}{'topic'}
115 0 0 unless (utf8::downgrade($e->{'message'}, 1))
130 0 0 if (@_ > 1)
133 0 0 if defined $password and not $self->_secure || $ENV{'MQTT_SIMPLE_ALLOW_INSECURE_LOGIN'}
146 0 0 if $self->{'socket'} and $self->{'socket'}->connected
148 0 0 if ($self->{'last_connect'} > time - $RECONNECT_INTERVAL)
164 0 0 unless $self->{'socket'} = $socket_class->new(%socket_options)
182 0 0 if $v
191 0 0 unless exists $self->{'skip_connect'}
194 0 0 unless my $socket = $self->{'socket'}
197 0 0 unless syswrite $socket, $chunk
209 0 0 if $will
210 0 0 if $will and $will->{'retain'}
212 0 0 if defined $self->{'username'}
213 0 0 if defined $self->{'username'} and defined $self->{'password'}
227 0 0 $flags & 4 ? :
0 0 $flags & 128 ? :
0 0 $flags & 64 ? :
0 0 $flags & 4 ? :
0 0 $flags & 128 ? :
0 0 $flags & 64 ? :
234 0 0 unless (@topics)
235 0 0 unless @topics = keys %{$$self{"sub"};}
237 0 0 unless @topics
251 0 0 unless @topics
266 0 0 if length $$bufref < 2
275 0 0 if $offset >= length $$bufref
283 0 0 if ($length > $MAX_LENGTH)
291 0 0 if length $$bufref < $offset + $length
318 0 0 if ($topic =~ /$cb->{'regex'}/)
328 0 0 if $retain
331 0 0 unless (utf8::downgrade($message, 1))
337 0 0 $retain ? :
347 0 0 $method ? :
0 0 unless @_ == ($method ? 3 : 2)
349 0 0 $method ? :
354 0 0 $method ? :
0 0 unless @_ == ($method ? 3 : 2)
356 0 0 $method ? :
362 0 0 if @subscribe_args
367 0 0 if exists $self->{'last_send'}
369 0 0 if exists $self->{'ping'}
372 0 0 @timeouts ? :
393 0 0 if $self->{'socket'}
414 0 0 unless my $socket = $self->{'socket'}
420 0 0 if (select $r, undef, undef, $timeout // 0)
422 0 0 unless sysread $socket, $$bufref, $READ_BYTES, length $$bufref
425 0 0 unless my $packet = $self->_parse
426 0 0 if $packet->{'type'} == 3
427 0 0 if $packet->{'type'} == 13
431 0 0 if (time >= $self->{'last_send'} + $KEEPALIVE_INTERVAL)
435 0 0 if ($self->{'ping'} and time >= $self->{'ping'} + $PING_TIMEOUT)
446 0 0 if $self->{'socket'} and $self->{'socket'}->connected