Branch Coverage

blib/lib/Net/SNMP/Message.pm
Criterion Covered Total %
branch 127 446 28.4


line true false branch
196 1 7 if (/^-?callback$/i) { }
0 7 elsif (/^-?debug$/i) { }
1 6 elsif (/^-?leadingdot$/i) { }
0 6 elsif (/^-?msgid$/i) { }
1 5 elsif (/^-?requestid$/i) { }
1 4 elsif (/^-?security$/i) { }
1 3 elsif (/^-?translate$/i) { }
1 2 elsif (/^-?transport$/i) { }
2 0 elsif (/^-?version$/i) { }
218 0 8 if (defined $$this{'_error'})
219 0 0 wantarray ? :
224 4 1 wantarray ? :
258 0 21 if defined $_[0]{'_error'}
260 0 21 unless (defined $_[1])
264 0 21 unless (exists $$prepare_methods{$_[1]})
305 0 17 if defined $_[0]{'_error'}
307 0 17 unless defined(my $type = $_[0]->_buffer_get(1))
311 0 17 unless (exists $$process_methods{$type})
316 0 10 if (@_ > 1 and defined $_[1] and $type != $_[1])
323 0 17 if (@_ == 3)
337 0 0 if (@_ == 2)
338 0 0 unless (defined $engine_id)
344 0 0 if (exists $$this{'_context_engine_id'}) { }
0 0 elsif (defined $$this{'_security'}) { }
359 0 0 if (@_ == 2)
360 0 0 unless (defined $name)
366 0 0 exists $$this{'_context_name'} ? :
377 0 0 if (@_ == 2)
378 0 0 unless (defined $flags)
384 0 0 if (exists $$this{'_msg_flags'})
397 0 1 if (@_ == 2)
398 0 0 unless (defined $msg_id)
401 0 0 if ($msg_id < 0 or $msg_id > 2147483647)
409 0 1 if (exists $$this{'_msg_id'}) { }
1 0 elsif (exists $$this{'_request_id'}) { }
424 0 0 if (@_ == 2)
425 0 0 unless (defined $size)
428 0 0 if ($size < 484 or $size > 2147483647)
445 0 0 if (@_ == 2)
446 0 0 unless (defined $model)
449 0 0 if ($model < 1 or $model > 2147483647)
457 0 0 if (exists $$this{'_security_model'}) { }
0 0 elsif (defined $$this{'_security'}) { }
462 0 0 if ($$this{'_version'} == SNMP_VERSION_1()) { }
0 0 elsif ($$this{'_version'} == SNMP_VERSION_2C()) { }
0 0 elsif ($$this{'_version'} == SNMP_VERSION_3()) { }
480 1 1 if (@_ == 2)
481 0 1 unless (defined $request_id)
487 2 0 exists $$this{'_request_id'} ? :
498 0 0 if (@_ == 2)
499 0 0 unless (defined $level)
502 0 0 if ($level < SECURITY_LEVEL_NOAUTHNOPRIV() or $level > SECURITY_LEVEL_AUTHPRIV())
513 0 0 if (exists $$this{'_security_level'}) { }
0 0 elsif (defined $$this{'_security'}) { }
526 1 0 if (@_ == 2)
527 0 1 unless (defined $name)
534 1 0 if (exists $$this{'_security_name'}) { }
0 0 elsif (defined $$this{'_security'}) { }
547 4 4 if (@_ == 2)
548 4 0 if ($version == SNMP_VERSION_1() or $version == SNMP_VERSION_2C() or $version == SNMP_VERSION_3()) { }
594 2 3 if (@_ == 2)
595 2 0 if (defined $security) { }
614 2 1 if (@_ == 2)
615 2 0 if (defined $transport) { }
630 0 0 if (defined $$this{'_transport'})
652 0 0 unless (defined $$this{'_transport'})
656 0 0 if (@_ == 2)
658 0 0 if (defined($size = $$this{'_transport'}->max_msg_size($size)))
669 0 0 defined $_[0]{'_transport'} ? :
674 0 0 defined $_[0]{'_transport'} ? :
683 0 0 unless (defined $$this{'_transport'})
690 0 0 if (defined(my $bytes = $$this{'_transport'}->send($$this{'_buffer'})))
703 0 0 unless (defined $$this{'_transport'})
709 0 0 if (defined $name)
725 2 1 @_ == 2 ? :
730 1 1 @_ == 2 ? :
741 1 1 if (@_ == 2)
742 0 1 if (ref $callback eq 'CODE') { }
1 0 elsif (not defined $callback) { }
758 0 0 unless (defined $$this{'_callback'})
771 0 0 $@ ? :
778 0 0 if (@_)
779 0 0 @_ > 1 ? :
780 0 0 if ($this->debug)
797 0 0 @_ == 2 ? :
808 2 0 if (@_ == 2 and $index >= 0 and $index <= $$this{'_length'})
863 0 3 if (@_)
864 0 0 if (defined $_[0]) { }
865 0 0 @_ > 1 ? :
866 0 0 if ($this->debug)
880 0 0 $_[1] ? :
0 0 @_ == 2 ? :
887 0 0 if $AUTOLOAD =~ /::DESTROY$/
891 0 0 if (ref $this) { }
913 0 18 unless (defined $_[1])
919 18 0 if ($length < 128) { }
0 0 elsif ($length <= 255) { }
0 0 elsif ($length <= 65535) { }
934 0 6 unless (defined $value)
938 0 6 unless ($value =~ /^-?\d+$/)
944 0 6 if ($value < -2147483648 or $value > 4294967295)
958 0 0 unless (defined $value)
962 0 0 unless ($value =~ /^\d+$/)
969 0 0 if ($value < 0 or $value > 4294967295)
993 1 5 if ($value & 4278190080 & 2147483648 and not $negative)
1010 1 5 if ($prefix)
1029 0 6 unless (defined $value)
1045 0 2 unless (defined $value)
1050 0 2 unless ($value =~ /^\.?\d+(?:\.\d+)* *$/)
1064 1 1 if ($subids[0] eq '')
1073 0 2 if (@subids > 128)
1080 18 0 unless $_ < 0
0 2 if (grep {$_ > 4294967295 unless $_ < 0;} @subids)
1100 0 2 if ($subids[0] > 2)
1109 0 2 if ($subids[0] < 2 and $subids[1] >= 40) { }
0 2 elsif ($subids[1] >= 4294967215) { }
1142 3 3 if (defined $value)
1149 3 0 if ($$this{'_length'} < 128) { }
0 0 elsif ($$this{'_length'} <= 255) { }
0 0 elsif ($$this{'_length'} <= 65535) { }
1164 0 0 unless (defined $value)
1168 0 0 unless ($value =~ /^\d+\.\d+\.\d+\.\d+$/)
1177 0 0 if (grep {$_ > 255;} @octets)
1203 0 0 unless (defined $value)
1215 0 1 if ($$this{'_version'} == SNMP_VERSION_1())
1220 0 1 unless (defined $value)
1224 0 1 unless ($value =~ /^\+?\d+$/)
1233 0 1 if ($value eq 'NaN')
1238 0 1 if ($value->bcmp('18446744073709551615') > 0)
1248 0 1 if ($value == 0)
1259 1 0 if ($bytes[0] & 128)
1270 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1281 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1294 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1325 0 0 if ($$this{'_version'} != SNMP_VERSION_1())
1336 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1349 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1360 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1371 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1386 0 17 if defined $$this{'_error'}
1390 0 17 unless (defined $length)
1396 17 0 unless ($length & 128)
1402 0 0 if ($byte_cnt == 0) { }
0 0 elsif ($byte_cnt > 4) { }
1410 0 0 unless (defined($length = $this->_buffer_get($byte_cnt)))
1422 0 6 unless defined(my $length = $this->_process_length)
1425 0 6 if ($length < 1)
1430 0 6 unless defined(my $bytes = $this->_buffer_get($length))
1437 0 6 if ($length > 5 or $length > 4 and $bytes[0] != 0)
1444 1 5 if ($bytes[0] & 128)
1452 1 5 if ($negative)
1453 1 0 if ($type == INTEGER() or not $$this{'_translate'} & TRANSLATE_UNSIGNED()) { }
1469 0 5 unless defined(my $length = $this->_process_length)
1472 0 5 unless defined(my $s = $this->_buffer_get($length))
1475 0 5 $type == OPAQUE() ? :
1490 1 4 if ($$this{'_translate'} & $mask)
1492 1 0 if ($s =~ / # The values other than NUL, LF, CR, BEL, BS, HT, VT, FF, # and the graphic characters (32-126) trigger translation. [\x01-\x06\x0e-\x1f\x7f-\xff]| # The sequence 'CR x' for any x other than LF or NUL # also triggers translation. \x0d(?![\x00\x0a]) /x) { }
1521 0 0 unless defined(my $length = $this->_process_length)
1523 0 0 if $length != 0
1525 0 0 if ($$this{'_translate'} & TRANSLATE_NULL())
1538 0 1 unless defined(my $length = $this->_process_length)
1541 0 1 if ($length < 1)
1547 0 1 unless defined(my $bytes = $this->_buffer_get($length))
1554 0 1 if ($@ or grep {$_ > 4294967295;} @oid)
1561 0 1 if (@oid > 128)
1571 1 0 if ($oid[1] == 43) { }
0 0 elsif ($oid[1] < 40) { }
0 0 elsif ($oid[1] < 80) { }
1587 1 0 if ($$this{'_leading_dot'})
1606 0 0 unless defined(my $length = $this->_process_length)
1608 0 0 if ($length != 4)
1612 0 0 if (defined(my $ipaddress = $this->_buffer_get(4)))
1633 0 0 if (defined(my $ticks = $this->_process_integer32(TIMETICKS())))
1634 0 0 if ($$this{'_translate'} & TRANSLATE_TIMETICKS()) { }
1655 0 1 if ($$this{'_version'} == SNMP_VERSION_1())
1660 0 1 unless defined(my $length = $this->_process_length)
1663 0 1 if ($length < 1)
1668 0 1 unless defined(my $bytes = $this->_buffer_get($length))
1674 0 1 if ($length > 9 or $length > 8 and $bytes[0] != 0)
1681 0 1 if ($bytes[0] & 128)
1689 0 8 if ($negative)
1697 0 1 if ($negative)
1699 0 0 if ($$this{'_translate'} & TRANSLATE_UNSIGNED())
1719 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1724 0 0 unless defined(my $length = $this->_process_length)
1726 0 0 if ($length != 0)
1730 0 0 if ($$this{'_translate'} & TRANSLATE_NOSUCHOBJECT())
1746 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1753 0 0 unless defined(my $length = $this->_process_length)
1755 0 0 if ($length != 0)
1759 0 0 if ($$this{'_translate'} & TRANSLATE_NOSUCHINSTANCE())
1775 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1780 0 0 unless defined(my $length = $this->_process_length)
1782 0 0 if ($length != 0)
1786 0 0 if ($$this{'_translate'} & TRANSLATE_ENDOFMIBVIEW())
1804 1 0 defined $this->_process_length ? :
1831 0 0 if ($$this{'_version'} != SNMP_VERSION_1())
1842 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1853 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1864 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1875 0 0 if ($$this{'_version'} == SNMP_VERSION_1())
1917 0 3 if @_ != 1
1919 0 3 unless (exists $$types{$type})
1942 0 0 if ($days != 0) { }
0 0 elsif ($hours != 0) { }
0 0 elsif ($minutes != 0) { }
1943 0 0 $days == 1 ? :
1946 0 0 $hours == 1 ? :
1949 0 0 $minutes == 1 ? :
1952 0 0 $seconds == 1 ? :
1964 0 0 unless (defined $$this{'_error'})
1965 0 0 @_ > 1 ? :
1966 0 0 if ($this->debug)
1988 0 3 if defined $_[0]{'_error'}
2004 0 47 if defined $$this{'_error'}
2009 47 0 if (@_ == 2)
2011 0 47 if (($$this{'_index'} += $requested) > $$this{'_length'})
2013 0 0 if ($$this{'_length'} >= $this->max_msg_size)
2038 0 23 if defined $_[0]{'_error'}
2056 0 0 unless $DEBUG
2058 0 0 $$this{'_length'} != 1 ? :
2076 3 0 unless $DEBUG
2078 0 0 @_ > 1 ? :