Branch Coverage

blib/lib/Net/IP.pm
Criterion Covered Total %
branch 172 336 51.1


line true false branch
160 0 0 if ($ip > $self->last_int)
192 0 36021 unless ($self->set($data, $ipversion))
210 3 36036 unless (my($begin, $end) = ip_normalize($data, $ipversion))
227 0 36036 unless $$self{'ipversion'} = $ipversion || ip_get_version($begin)
234 0 36036 unless $$self{'binip'} = ip_iptobin($self->ip, $self->version)
247 0 36036 if ($ver != $self->version)
258 0 36036 unless $$self{'last_bin'} = ip_iptobin($self->last_ip, $self->version)
262 0 36036 unless (ip_bincomp($self->binip, 'le', $self->last_bin))
271 0 36036 unless my(@prefixes) = $self->find_prefixes
274 36034 2 if (scalar @prefixes == 1)
278 0 36034 unless (undef, $$self{'prefixlen'}) = ip_splitprefix($prefixes[0])
286 36034 2 if ($$self{'is_prefix'})
292 0 36034 unless (ip_check_prefix($self->binip, $self->prefixlen, $self->version))
310 36009 0 if ($$self{'is_prefix'}) { }
415 3 5 if defined $$self{'intformat'}
419 0 5 unless ($int)
436 0 4 if defined $$self{'hexformat'}
448 0 2 if defined $$self{'hexmask'}
464 0 0 unless ($self->is_prefix)
470 0 0 if defined $$self{'prefix'}
474 0 0 unless ($prefix)
492 0 2 unless ($self->is_prefix)
498 0 2 if defined $$self{'mask'}
502 0 2 unless ($mask)
522 28008 8003 if ($self->version == 6) { }
529 0 36011 unless (defined $r)
545 0 36010 if defined $$self{'iptype'}
549 0 36010 unless ($type)
567 0 2 unless ($self->is_prefix)
573 0 2 if defined $$self{'reverse_ip'}
577 0 2 unless ($rev)
595 72086 0 if defined $$self{'last_bin'}
599 0 0 if ($self->is_prefix) { }
608 0 0 unless ($last)
626 0 2 if defined $$self{'last_int'}
628 0 2 unless my $last_bin = $self->last_bin
630 0 2 unless my $last_int = ip_bintoint($last_bin, $self->version)
644 36038 0 if defined $$self{'last_ip'}
648 0 0 unless ($last)
670 0 36039 unless (scalar @list)
690 0 2 unless (defined $a)
709 0 2 unless ($ip)
715 0 2 unless my $new = 'Net::IP'->new(ip_bintoip($ip, $self->version))
734 0 2 unless ($r)
762 0 2 unless (defined $r)
780 0 0 if defined $$self{'auth'}
784 0 0 unless ($auth)
821 40166 140128 if ($version == 4) { }
140128 0 elsif ($version == 6) { }
841 16050 56040 if ($ipversion == 4)
849 0 56040 unless (length $ip == 32)
870 0 36076 if ($len < length $binip)
880 8043 28033 if ($ip_version == 4)
904 155 325 if $_
927 0 0 unless ($ip_version)
956 24056 84051 if not $ip =~ /:/ and ip_is_ipv4($ip)
959 84050 1 if ip_is_ipv6($ip)
973 0 24056 unless ($ip =~ /^[\d\.]+$/)
979 0 24056 if ($ip =~ /^\./)
985 0 24056 if ($ip =~ /\.$/)
992 1 24055 if ($ip =~ /^(\d+)$/ and $1 < 256)
998 0 24055 unless ($n >= 0 and $n < 4)
1005 0 24055 if ($ip =~ /\.\./)
1014 0 96214 unless ($_ >= 0 and $_ < 256)
1033 0 84055 unless $n > 0 and $n < 8
1042 11 672359 if $_ eq ''
1045 672359 0 if /^[a-f\d]{1,4}$/i
1048 0 0 if ($k == $n + 1 and ip_is_ipv4($_))
1059 1 84054 if ($ip =~ /^:[^:]/)
1066 0 84054 if ($ip =~ /[^:]:$/)
1073 0 84054 if ($ip =~ s/:(?=:)/:/g > 1)
1080 2 84052 if ($n != 7 and not $ip =~ /::/)
1098 0 64055 unless ($ip_version)
1105 8024 56031 if ($ip_version == 4)
1109 0 8024 if (scalar @quads > 4)
1119 1 32083 unless ($q =~ /^\d{1,3}$/)
1134 1 56030 if ($num_of_double_colon > 1)
1149 0 448192 if ($ip[$_] =~ /\./)
1159 0 0 unless defined $ip[$_]
1175 448168 12 unless $ip[$_] eq '000!'
1196 0 36034 unless ($ip_version)
1216 0 17 unless ($ip_version)
1241 0 36034 unless $prefix =~ m[^([^/]+?)(/\d+)?$]
1245 36034 0 if defined $len
1258 0 0 unless ($ip_version)
1270 0 0 unless my $binip = ip_iptobin($ip, $ip_version)
1272 0 0 unless ip_check_prefix($binip, $len, $ip_version)
1274 0 0 unless my $lastip = ip_last_address_bin($binip, $len, $ip_version)
1275 0 0 unless $lastip = ip_bintoip($lastip, $ip_version)
1288 0 0 unless ($ip_version)
1296 0 0 if (length $mask != $len)
1303 0 0 unless ($mask =~ /^1*0*$/)
1323 185421 2 if ($op =~ /^l[te]$/) { }
2 0 elsif ($op =~ /^g[te]$/) { }
1338 108081 77342 if $op =~ /e/ and $begin eq $end
1341 0 77342 unless (length $b eq length $e)
1356 73 7923931 if $c == 1
1357 77269 7846662 if $c == -1
1373 0 36059 unless (length $b eq length $e)
1396 40593 3803887 if ($c > 1)
1417 0 36055 unless (length $bin1 eq length $bin2)
1431 36055 522 if substr($bin1, $_, 1) eq substr($bin2, $_, 1)
1447 0 36041 unless ($ip_version)
1453 0 36041 unless (length $binip eq length $endbinip)
1468 18041 18014 if ($binip =~ /(0+)$/) { }
1499 3 36052 if $current =~ /^1+$/
1517 0 8003 if $qlen < 0
1532 0 28009 unless ($ip_version)
1539 0 28009 if $ip_version == 4
1564 2036 1 if length $reg < length $1
1568 2035 25974 if $reg ne ''
1590 0 2 unless (length $b1 eq length $e1 and length $b2 eq length $e2 and length $b1 eq length $b2)
1600 0 2 unless (ip_bincomp($b1, 'le', $e1) == 1)
1607 0 2 unless (ip_bincomp($b2, 'le', $e2) == 1)
1614 0 2 if ($b1 eq $b2)
1617 0 0 if $e1 eq $e2
1621 0 0 ip_bincomp($e1, 'lt', $e2) ? :
1628 0 2 if ($e1 eq $e2)
1632 0 0 ip_bincomp($b1, 'lt', $b2) ? :
1639 1 1 if (ip_bincomp($b1, 'lt', $b2) == 1) { }
1642 0 1 if ip_bincomp($e1, 'lt', $b2) == 1
1646 0 1 ip_bincomp($e1, 'lt', $e2) ? :
1655 1 0 if ip_bincomp($e2, 'lt', $b1) == 1
1659 0 0 ip_bincomp($e2, 'lt', $e1) ? :
1677 0 0 unless @ip
1680 0 0 if ip_is_ipv4($ip[-1])
1694 0 2 unless ($ip_version)
1704 0 2 unless (ip_binadd($bineip1, $one) eq $binbip2)
1714 0 2 if scalar @prefix < 1
1716 0 2 if (scalar @prefix > 1)
1734 8003 28007 if $ip_version == 4
1735 28007 0 if $ip_version == 6
1752 0 8003 unless ($ip =~ /^[01]{1,32}$/)
1760 4102 113431 if $ip =~ /^$_/
1776 0 28007 unless ($ip =~ /^[01]{1,128}$/)
1783 28007 422028 if $ip =~ /^$_/
1801 0 36052 if ($len > length $binip)
1812 1 36051 unless ($rest =~ /^0*$/)
1819 0 36051 unless (length($rest) + $len == ip_iplengths($ipversion))
1838 0 4 unless ($ip_version)
1844 1 3 if ($ip_version == 4) { }
3 0 elsif ($ip_version == 6) { }
1866 3 0 $len ? :
1885 19 36020 if ($data =~ m[^(\S+?)(/\S+)$]) { }
4 36016 elsif ($data =~ /^(.+?)\s*\-\s*(.+)$/) { }
0 36016 elsif ($data =~ /^(.+?)\s+\+\s+(.+)$/) { }
1888 1 18 unless $ipversion = ip_get_version($ip)
1889 0 18 unless $ip = ip_expand_address($ip, $ipversion)
1890 0 18 unless $curr_bin = ip_iptobin($ip, $ipversion)
1895 0 18 unless $len =~ s[^/(\d+)(\,|$)][]
1900 1 17 unless ip_check_prefix($curr_bin, $clen, $ipversion)
1903 0 17 unless $curr_bin = ip_last_address_bin($curr_bin, $clen, $ipversion)
1906 0 17 if ($addcst)
1907 0 0 unless $curr_bin = ip_binadd($curr_bin, $one)
1918 0 4 unless $ipversion = ip_get_version($ip)
1920 0 4 unless $ip = ip_expand_address($ip, $ipversion)
1921 1 3 unless $ip2 = ip_expand_address($ip2, $ipversion)
1930 0 0 unless $ipversion = ip_get_version($ip)
1931 0 0 unless $ip = ip_expand_address($ip, $ipversion)
1934 0 0 unless $bin_ip = ip_iptobin($ip, $ipversion)
1936 0 0 unless $len = ip_inttobin($len, $ipversion)
1938 0 0 unless $ip2 = ip_binadd($bin_ip, $len)
1939 0 0 unless $ip2 = ip_bintoip($ip2, $ipversion)
1948 0 36016 unless $ipversion = ip_get_version($ip)
1950 0 36016 unless $ip = ip_expand_address($ip, $ipversion)
1966 0 0 unless $ip1
1982 0 0 unless ($ip_version)
1989 0 0 if ($ip_version != 4)