Branch Coverage

blib/lib/Net/MQTT/Simple.pm
Criterion Covered Total %
branch 6 128 4.6


line true false branch
37 20 535 if $filter eq "#"
38 17 518 if $filter eq "/#"
52 0 2 unless @_ <= 2
54 2 0 unless $server
65 0 0 unless @_ == 2 or @_ == 3
70 0 0 if $server =~ /:.*:/ and not $server =~ /\[/
73 0 0 if not $server =~ /:/ or $server =~ /^\[.*\]$/
90 0 0 if $self->{'will'}
92 0 0 if @_ > 4
94 0 0 if (@_ >= 2)
95 0 0 if (not defined $topic || defined $message) { }
106 0 0 unless length $self->{'will'}{'topic'}
110 0 0 unless (utf8::downgrade($e->{'message'}, 1))
125 0 0 if (@_ > 1)
128 0 0 if defined $password and not $self->_secure || $ENV{'MQTT_SIMPLE_ALLOW_INSECURE_LOGIN'}
141 0 0 if $self->{'socket'} and $self->{'socket'}->connected
143 0 0 if ($self->{'last_connect'} > time - $RECONNECT_INTERVAL)
159 0 0 unless $self->{'socket'} = $socket_class->new(%socket_options)
177 0 0 if $v
186 0 0 unless exists $self->{'skip_connect'}
189 0 0 unless my $socket = $self->{'socket'}
192 0 0 unless syswrite $socket, $chunk
204 0 0 if $will
205 0 0 if $will and $will->{'retain'}
207 0 0 if defined $self->{'username'}
208 0 0 if defined $self->{'username'} and defined $self->{'password'}
222 0 0 $flags & 4 ? :
0 0 $flags & 128 ? :
0 0 $flags & 64 ? :
0 0 $flags & 4 ? :
0 0 $flags & 128 ? :
0 0 $flags & 64 ? :
229 0 0 unless (@topics)
230 0 0 unless @topics = keys %{$$self{"sub"};}
232 0 0 unless @topics
246 0 0 unless @topics
261 0 0 if length $$bufref < 2
270 0 0 if $offset >= length $$bufref
278 0 0 if ($length > $MAX_LENGTH)
286 0 0 if length $$bufref < $offset + $length
313 0 0 if ($topic =~ /$cb->{'regex'}/)
323 0 0 if $retain
326 0 0 unless (utf8::downgrade($message, 1))
332 0 0 $retain ? :
342 0 0 $method ? :
0 0 unless @_ == ($method ? 3 : 2)
344 0 0 $method ? :
349 0 0 $method ? :
0 0 unless @_ == ($method ? 3 : 2)
351 0 0 $method ? :
357 0 0 if @subscribe_args
362 0 0 if exists $self->{'last_send'}
364 0 0 if exists $self->{'ping'}
367 0 0 @timeouts ? :
388 0 0 if $self->{'socket'}
409 0 0 unless my $socket = $self->{'socket'}
415 0 0 if (select($r, undef, undef, $timeout // 0) > 0)
417 0 0 unless sysread $socket, $$bufref, $READ_BYTES, length $$bufref
420 0 0 unless my $packet = $self->_parse
421 0 0 if $packet->{'type'} == 3
422 0 0 if $packet->{'type'} == 13
426 0 0 if (time >= $self->{'last_send'} + $KEEPALIVE_INTERVAL)
430 0 0 if ($self->{'ping'} and time >= $self->{'ping'} + $PING_TIMEOUT)
441 0 0 if $self->{'socket'} and $self->{'socket'}->connected