Branch Coverage

blib/lib/Net/MQTT/Simple.pm
Criterion Covered Total %
branch 6 140 4.2


line true false branch
38 20 535 if $filter eq "#"
39 17 518 if $filter eq "/#"
53 0 2 unless @_ <= 2
55 2 0 unless $server
67 0 0 unless @_ == 2 or @_ == 3
72 0 0 if $server =~ /:.*:/ and not $server =~ /\[/
75 0 0 if not $server =~ /:/ or $server =~ /^\[.*\]$/
92 0 0 if $self->{'will'}
94 0 0 if @_ > 4
96 0 0 if (@_ >= 2)
97 0 0 if (not defined $topic || defined $message) { }
108 0 0 unless length $self->{'will'}{'topic'}
112 0 0 unless (utf8::downgrade($e->{'message'}, 1))
127 0 0 if (@_ > 1)
130 0 0 if defined $password and not $self->_secure || $ENV{'MQTT_SIMPLE_ALLOW_INSECURE_LOGIN'}
143 0 0 if $self->{'socket'} and $self->{'socket'}->connected
145 0 0 if ($self->{'last_connect'} > time - $RECONNECT_INTERVAL)
164 0 0 unless ($self->{'socket'})
184 0 0 if $v
193 0 0 unless exists $self->{'skip_connect'}
195 0 0 unless my $socket = $self->{'socket'}
198 0 0 unless syswrite $socket, $chunk
210 0 0 if $will
211 0 0 if $will and $will->{'retain'}
213 0 0 if defined $self->{'username'}
214 0 0 if defined $self->{'username'} and defined $self->{'password'}
228 0 0 $flags & 4 ? :
0 0 $flags & 128 ? :
0 0 $flags & 64 ? :
0 0 $flags & 4 ? :
0 0 $flags & 128 ? :
0 0 $flags & 64 ? :
239 0 0 unless @topics
255 0 0 unless @topics
272 0 0 if length $$bufref < 2
281 0 0 if $offset >= length $$bufref
289 0 0 if ($length > $MAX_LENGTH)
297 0 0 if length $$bufref < $offset + $length
324 0 0 if ($topic =~ /$cb->{'regex'}/)
334 0 0 if $retain
337 0 0 unless (utf8::downgrade($message, 1))
343 0 0 $retain ? :
353 0 0 $method ? :
0 0 unless @_ == ($method ? 3 : 2)
355 0 0 $method ? :
360 0 0 $method ? :
0 0 unless @_ == ($method ? 3 : 2)
362 0 0 $method ? :
368 0 0 if @subscribe_args
373 0 0 if exists $self->{'last_send'}
375 0 0 if exists $self->{'ping'}
378 0 0 @timeouts ? :
399 0 0 if $self->{'socket'}
420 0 0 unless my $socket = $self->{'socket'}
426 0 0 if (select($r, undef, undef, $timeout // 0) > 0)
428 0 0 unless sysread $socket, $$bufref, $READ_BYTES, length $$bufref
431 0 0 unless my $packet = $self->_parse
432 0 0 if $packet->{'type'} == 3
433 0 0 if $packet->{'type'} == 13
437 0 0 if (time >= $self->{'last_send'} + $KEEPALIVE_INTERVAL)
441 0 0 if ($self->{'ping'} and time >= $self->{'ping'} + $PING_TIMEOUT)
461 0 0 $method ? :
0 0 $method ? :
0 0 unless @_ >= ($method ? 2 : 1)
464 0 0 $method ? :
470 0 0 unless $got_ref
493 0 0 unless %waiting
496 0 0 if $got_ref and wantarray
497 0 0 if $got_ref
504 0 0 if ($self->{'socket'} and $self->{'socket'}->connected)