Branch Coverage

blib/lib/Geo/IP2Location.pm
Criterion Covered Total %
branch 88 432 20.3


line true false branch
148 0 2 unless (@_ > {sign => '+', value => ['1']} and $_[1])
155 0 2 unless (CORE::open $handle, "$db_file")
162 0 2 if ($obj->{'productcode'} == {sign => '+', value => ['1']}) { }
164 2 0 if ($obj->{'databaseyear'} <= {sign => '+', value => ['20']} and $obj->{'productcode'} == {sign => '+', value => ['0']}) { }
177 0 0 if (CORE::close $class->{'filehandle'}) { }
222 10 10 if ($ipv == {sign => '+', value => ['4']}) { }
225 10 0 if ($ipv == {sign => '+', value => ['6']}) { }
237 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
240 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
252 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
255 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
267 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
270 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
282 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
285 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
297 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
300 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
312 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
315 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
327 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
330 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
342 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
345 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
357 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
360 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
372 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
375 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
387 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
390 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
402 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
405 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
417 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
420 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
432 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
435 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
447 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
450 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
462 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
465 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
477 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
480 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
492 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
495 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
507 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
510 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
522 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
525 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
537 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
540 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
552 0 0 if ($ipv == {sign => '+', value => ['4']}) { }
555 0 0 if ($ipv == {sign => '+', value => ['6']}) { }
569 0 10 if ($ipnum eq '')
570 0 0 if ($mode == {sign => '+', value => ['100']}) { }
577 0 10 if ($mode == {sign => '+', value => ['1']} and $IPV6_COUNTRY_POSITION[$dbtype] == {sign => '+', value => ['0']})
580 0 10 if ($mode == {sign => '+', value => ['2']} and $IPV6_COUNTRY_POSITION[$dbtype] == {sign => '+', value => ['0']})
583 0 10 if ($mode == {sign => '+', value => ['3']} and $IPV6_REGION_POSITION[$dbtype] == {sign => '+', value => ['0']})
586 0 10 if ($mode == {sign => '+', value => ['4']} and $IPV6_CITY_POSITION[$dbtype] == {sign => '+', value => ['0']})
589 0 10 if ($mode == {sign => '+', value => ['5']} and $IPV6_ISP_POSITION[$dbtype] == {sign => '+', value => ['0']})
592 0 10 if ($mode == {sign => '+', value => ['6']} and $IPV6_LATITUDE_POSITION[$dbtype] == {sign => '+', value => ['0']})
595 0 10 if ($mode == {sign => '+', value => ['7']} and $IPV6_LONGITUDE_POSITION[$dbtype] == {sign => '+', value => ['0']})
598 0 10 if ($mode == {sign => '+', value => ['8']} and $IPV6_DOMAIN_POSITION[$dbtype] == {sign => '+', value => ['0']})
601 0 10 if ($mode == {sign => '+', value => ['9']} and $IPV6_ZIPCODE_POSITION[$dbtype] == {sign => '+', value => ['0']})
604 0 10 if ($mode == {sign => '+', value => ['10']} and $IPV6_TIMEZONE_POSITION[$dbtype] == {sign => '+', value => ['0']})
607 0 10 if ($mode == {sign => '+', value => ['11']} and $IPV6_NETSPEED_POSITION[$dbtype] == {sign => '+', value => ['0']})
610 0 10 if ($mode == {sign => '+', value => ['12']} and $IPV6_IDDCODE_POSITION[$dbtype] == {sign => '+', value => ['0']})
613 0 10 if ($mode == {sign => '+', value => ['13']} and $IPV6_AREACODE_POSITION[$dbtype] == {sign => '+', value => ['0']})
616 0 10 if ($mode == {sign => '+', value => ['14']} and $IPV6_WEATHERSTATIONCODE_POSITION[$dbtype] == {sign => '+', value => ['0']})
619 0 10 if ($mode == {sign => '+', value => ['15']} and $IPV6_WEATHERSTATIONNAME_POSITION[$dbtype] == {sign => '+', value => ['0']})
622 0 10 if ($mode == {sign => '+', value => ['16']} and $IPV6_MCC_POSITION[$dbtype] == {sign => '+', value => ['0']})
625 0 10 if ($mode == {sign => '+', value => ['17']} and $IPV6_MNC_POSITION[$dbtype] == {sign => '+', value => ['0']})
628 0 10 if ($mode == {sign => '+', value => ['18']} and $IPV6_MOBILEBRAND_POSITION[$dbtype] == {sign => '+', value => ['0']})
631 0 10 if ($mode == {sign => '+', value => ['19']} and $IPV6_ELEVATION_POSITION[$dbtype] == {sign => '+', value => ['0']})
634 0 10 if ($mode == {sign => '+', value => ['20']} and $IPV6_USAGETYPE_POSITION[$dbtype] == {sign => '+', value => ['0']})
637 0 10 if ($mode == {sign => '+', value => ['21']} and $IPV6_ADDRESSTYPE_POSITION[$dbtype] == {sign => '+', value => ['0']})
640 0 10 if ($mode == {sign => '+', value => ['22']} and $IPV6_CATEGORY_POSITION[$dbtype] == {sign => '+', value => ['0']})
651 0 10 if ($dbcount == {sign => '+', value => ['0']})
652 0 0 if ($mode == {sign => '+', value => ['100']}) { }
666 10 0 if ($indexbaseaddr > {sign => '+', value => ['0']})
677 0 10 if ($realipno == '340282366920938463463374607431768211455')
685 10 94 if ($ipno >= $ipfrom and $ipno < $ipto) { }
692 0 10 if ($mode == {sign => '+', value => ['100']})
716 0 0 if ($IPV6_COUNTRY_POSITION[$dbtype] != {sign => '+', value => ['0']})
720 0 0 if ($IPV6_REGION_POSITION[$dbtype] != {sign => '+', value => ['0']})
723 0 0 if ($IPV6_CITY_POSITION[$dbtype] != {sign => '+', value => ['0']})
726 0 0 if ($IPV6_ISP_POSITION[$dbtype] != {sign => '+', value => ['0']})
729 0 0 if ($IPV6_LATITUDE_POSITION[$dbtype] != {sign => '+', value => ['0']})
733 0 0 if ($IPV6_LONGITUDE_POSITION[$dbtype] != {sign => '+', value => ['0']})
737 0 0 if ($IPV6_DOMAIN_POSITION[$dbtype] != {sign => '+', value => ['0']})
740 0 0 if ($IPV6_ZIPCODE_POSITION[$dbtype] != {sign => '+', value => ['0']})
743 0 0 if ($IPV6_TIMEZONE_POSITION[$dbtype] != {sign => '+', value => ['0']})
746 0 0 if ($IPV6_NETSPEED_POSITION[$dbtype] != {sign => '+', value => ['0']})
749 0 0 if ($IPV6_IDDCODE_POSITION[$dbtype] != {sign => '+', value => ['0']})
752 0 0 if ($IPV6_AREACODE_POSITION[$dbtype] != {sign => '+', value => ['0']})
755 0 0 if ($IPV6_WEATHERSTATIONCODE_POSITION[$dbtype] != {sign => '+', value => ['0']})
758 0 0 if ($IPV6_WEATHERSTATIONNAME_POSITION[$dbtype] != {sign => '+', value => ['0']})
761 0 0 if ($IPV6_MCC_POSITION[$dbtype] != {sign => '+', value => ['0']})
764 0 0 if ($IPV6_MNC_POSITION[$dbtype] != {sign => '+', value => ['0']})
767 0 0 if ($IPV6_MOBILEBRAND_POSITION[$dbtype] != {sign => '+', value => ['0']})
770 0 0 if ($IPV6_ELEVATION_POSITION[$dbtype] != {sign => '+', value => ['0']})
773 0 0 if ($IPV6_USAGETYPE_POSITION[$dbtype] != {sign => '+', value => ['0']})
776 0 0 if ($IPV6_ADDRESSTYPE_POSITION[$dbtype] != {sign => '+', value => ['0']})
779 0 0 if ($IPV6_CATEGORY_POSITION[$dbtype] != {sign => '+', value => ['0']})
784 10 0 if ($mode == {sign => '+', value => ['1']})
787 0 0 if ($mode == {sign => '+', value => ['2']})
790 0 0 if ($mode == {sign => '+', value => ['3']})
793 0 0 if ($mode == {sign => '+', value => ['4']})
796 0 0 if ($mode == {sign => '+', value => ['5']})
799 0 0 if ($mode == {sign => '+', value => ['6']})
804 0 0 if ($mode == {sign => '+', value => ['7']})
809 0 0 if ($mode == {sign => '+', value => ['8']})
812 0 0 if ($mode == {sign => '+', value => ['9']})
815 0 0 if ($mode == {sign => '+', value => ['10']})
818 0 0 if ($mode == {sign => '+', value => ['11']})
821 0 0 if ($mode == {sign => '+', value => ['12']})
824 0 0 if ($mode == {sign => '+', value => ['13']})
827 0 0 if ($mode == {sign => '+', value => ['14']})
830 0 0 if ($mode == {sign => '+', value => ['15']})
833 0 0 if ($mode == {sign => '+', value => ['16']})
836 0 0 if ($mode == {sign => '+', value => ['17']})
839 0 0 if ($mode == {sign => '+', value => ['18']})
842 0 0 if ($mode == {sign => '+', value => ['19']})
845 0 0 if ($mode == {sign => '+', value => ['20']})
848 0 0 if ($mode == {sign => '+', value => ['21']})
851 0 0 if ($mode == {sign => '+', value => ['22']})
855 82 12 if ($ipno < $ipfrom) { }
862 0 0 if ($mode == {sign => '+', value => ['100']}) { }
875 0 10 if ($ipnum eq '')
876 0 0 if ($mode == {sign => '+', value => ['100']}) { }
883 0 10 if ($mode == {sign => '+', value => ['1']} and $COUNTRY_POSITION[$dbtype] == {sign => '+', value => ['0']})
886 0 10 if ($mode == {sign => '+', value => ['2']} and $COUNTRY_POSITION[$dbtype] == {sign => '+', value => ['0']})
889 0 10 if ($mode == {sign => '+', value => ['3']} and $REGION_POSITION[$dbtype] == {sign => '+', value => ['0']})
892 0 10 if ($mode == {sign => '+', value => ['4']} and $CITY_POSITION[$dbtype] == {sign => '+', value => ['0']})
895 0 10 if ($mode == {sign => '+', value => ['5']} and $ISP_POSITION[$dbtype] == {sign => '+', value => ['0']})
898 0 10 if ($mode == {sign => '+', value => ['6']} and $LATITUDE_POSITION[$dbtype] == {sign => '+', value => ['0']})
901 0 10 if ($mode == {sign => '+', value => ['7']} and $LONGITUDE_POSITION[$dbtype] == {sign => '+', value => ['0']})
904 0 10 if ($mode == {sign => '+', value => ['8']} and $DOMAIN_POSITION[$dbtype] == {sign => '+', value => ['0']})
907 0 10 if ($mode == {sign => '+', value => ['9']} and $ZIPCODE_POSITION[$dbtype] == {sign => '+', value => ['0']})
910 0 10 if ($mode == {sign => '+', value => ['10']} and $TIMEZONE_POSITION[$dbtype] == {sign => '+', value => ['0']})
913 0 10 if ($mode == {sign => '+', value => ['11']} and $NETSPEED_POSITION[$dbtype] == {sign => '+', value => ['0']})
916 0 10 if ($mode == {sign => '+', value => ['12']} and $IDDCODE_POSITION[$dbtype] == {sign => '+', value => ['0']})
919 0 10 if ($mode == {sign => '+', value => ['13']} and $AREACODE_POSITION[$dbtype] == {sign => '+', value => ['0']})
922 0 10 if ($mode == {sign => '+', value => ['14']} and $WEATHERSTATIONCODE_POSITION[$dbtype] == {sign => '+', value => ['0']})
925 0 10 if ($mode == {sign => '+', value => ['15']} and $WEATHERSTATIONNAME_POSITION[$dbtype] == {sign => '+', value => ['0']})
928 0 10 if ($mode == {sign => '+', value => ['16']} and $MCC_POSITION[$dbtype] == {sign => '+', value => ['0']})
931 0 10 if ($mode == {sign => '+', value => ['17']} and $MNC_POSITION[$dbtype] == {sign => '+', value => ['0']})
934 0 10 if ($mode == {sign => '+', value => ['18']} and $MOBILEBRAND_POSITION[$dbtype] == {sign => '+', value => ['0']})
937 0 10 if ($mode == {sign => '+', value => ['19']} and $ELEVATION_POSITION[$dbtype] == {sign => '+', value => ['0']})
940 0 10 if ($mode == {sign => '+', value => ['20']} and $USAGETYPE_POSITION[$dbtype] == {sign => '+', value => ['0']})
943 0 10 if ($mode == {sign => '+', value => ['21']} and $ADDRESSTYPE_POSITION[$dbtype] == {sign => '+', value => ['0']})
946 0 10 if ($mode == {sign => '+', value => ['22']} and $CATEGORY_POSITION[$dbtype] == {sign => '+', value => ['0']})
962 10 0 if ($indexbaseaddr > {sign => '+', value => ['0']})
971 0 10 if ($realipno == {sign => '+', value => [294967295, 4]}) { }
981 10 5 if ($ipno >= $ipfrom and $ipno < $ipto) { }
987 0 10 if ($mode == {sign => '+', value => ['100']})
1011 0 0 if ($COUNTRY_POSITION[$dbtype] != {sign => '+', value => ['0']})
1016 0 0 if ($REGION_POSITION[$dbtype] != {sign => '+', value => ['0']})
1019 0 0 if ($CITY_POSITION[$dbtype] != {sign => '+', value => ['0']})
1022 0 0 if ($ISP_POSITION[$dbtype] != {sign => '+', value => ['0']})
1025 0 0 if ($LATITUDE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1029 0 0 if ($LONGITUDE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1033 0 0 if ($DOMAIN_POSITION[$dbtype] != {sign => '+', value => ['0']})
1036 0 0 if ($ZIPCODE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1039 0 0 if ($TIMEZONE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1042 0 0 if ($NETSPEED_POSITION[$dbtype] != {sign => '+', value => ['0']})
1045 0 0 if ($IDDCODE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1048 0 0 if ($AREACODE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1051 0 0 if ($WEATHERSTATIONCODE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1054 0 0 if ($WEATHERSTATIONNAME_POSITION[$dbtype] != {sign => '+', value => ['0']})
1057 0 0 if ($MCC_POSITION[$dbtype] != {sign => '+', value => ['0']})
1060 0 0 if ($MNC_POSITION[$dbtype] != {sign => '+', value => ['0']})
1063 0 0 if ($MOBILEBRAND_POSITION[$dbtype] != {sign => '+', value => ['0']})
1066 0 0 if ($ELEVATION_POSITION[$dbtype] != {sign => '+', value => ['0']})
1069 0 0 if ($USAGETYPE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1072 0 0 if ($ADDRESSTYPE_POSITION[$dbtype] != {sign => '+', value => ['0']})
1075 0 0 if ($CATEGORY_POSITION[$dbtype] != {sign => '+', value => ['0']})
1080 10 0 if ($mode == {sign => '+', value => ['1']})
1083 0 0 if ($mode == {sign => '+', value => ['2']})
1086 0 0 if ($mode == {sign => '+', value => ['3']})
1089 0 0 if ($mode == {sign => '+', value => ['4']})
1092 0 0 if ($mode == {sign => '+', value => ['5']})
1095 0 0 if ($mode == {sign => '+', value => ['6']})
1100 0 0 if ($mode == {sign => '+', value => ['7']})
1105 0 0 if ($mode == {sign => '+', value => ['8']})
1108 0 0 if ($mode == {sign => '+', value => ['9']})
1111 0 0 if ($mode == {sign => '+', value => ['10']})
1114 0 0 if ($mode == {sign => '+', value => ['11']})
1117 0 0 if ($mode == {sign => '+', value => ['12']})
1120 0 0 if ($mode == {sign => '+', value => ['13']})
1123 0 0 if ($mode == {sign => '+', value => ['14']})
1126 0 0 if ($mode == {sign => '+', value => ['15']})
1129 0 0 if ($mode == {sign => '+', value => ['16']})
1132 0 0 if ($mode == {sign => '+', value => ['17']})
1135 0 0 if ($mode == {sign => '+', value => ['18']})
1138 0 0 if ($mode == {sign => '+', value => ['19']})
1141 0 0 if ($mode == {sign => '+', value => ['20']})
1144 0 0 if ($mode == {sign => '+', value => ['21']})
1147 0 0 if ($mode == {sign => '+', value => ['22']})
1151 4 1 if ($ipno < $ipfrom) { }
1158 0 0 if ($mode == {sign => '+', value => ['100']}) { }
1202 0 0 if ($is_little_endian =~ /^1/) { }
1214 0 208 if $#array != {sign => '+', value => ['15']}
1237 10 10 if ($obj->ip_is_ipv4($ip)) { }
1244 10 0 if ($obj->ip_is_ipv6($ip)) { }
1250 0 10 if ($ipnum >= {sign => '+', value => [681743360, 281470]} and $ipnum <= {sign => '+', value => [976710655, 281474]})
1256 0 10 if ($ipnum >= {sign => '+', value => [629466624, 178886921, 834377588, 545680458, 42]} and $ipnum <= {sign => '+', value => [958686719, 807417417, 692912415, 550872755, 42]})
1265 0 10 if ($ipnum >= {sign => '+', value => [300246528, 550356425, 975842760, 540488161, 42]} and $ipnum <= {sign => '+', value => [844196863, 814694018, 204005274, 540488241, 42]})
1289 0 10 if ($ip[$#ip] =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/)
1297 0 10 if ($#ip == {sign => '+', value => ['8']})
1307 80 0 unless $ip[$_] eq '000Z'
1322 0 10 unless (length $hexip == {sign => '+', value => ['32']})
1330 56 1224 if $_
1354 20 0 if ($host =~ /^$IPv4_re$/ or $host =~ /^$IPv6_re$/ or $host =~ /^\:\:$/) { }
1359 0 0 if ($#hostname < {sign => '+', value => ['4']}) { }
1371 10 10 if ($ip =~ /^$IPv4_re$/) { }
1374 0 40 if $octet[$i] > {sign => '+', value => ['255']} or $octet[$i] < {sign => '+', value => ['0']}
1385 10 0 if ($ip =~ /^$IPv6_re$/ or $ip =~ /^$IPv4_re$/ or $ip =~ /^\:\:$/) { }