Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/RelayCountry.pm
Criterion Covered Total %
branch 6 84 7.1


line true false branch
116 0 0 unless ($value =~ /^(?:GeoIP|GeoIP2|DB_File|Fast)$/)
148 0 0 unless (defined $value and length $value)
151 0 0 unless (-e $value)
179 0 0 if ($value eq '')
196 0 0 if ($ip =~ /^$IP_PRIVATE$/o) { }
0 0 elsif ($country_db_type eq 'GeoIP') { }
0 0 elsif ($country_db_type eq 'GeoIP2') { }
0 0 elsif ($country_db_type eq 'DB_File') { }
0 0 elsif ($country_db_type eq 'Fast') { }
200 0 0 if ($ip =~ /^$IPV4_ADDRESS$/o) { }
0 0 elsif (defined $dbv6) { }
209 0 0 if (index($db->metadata->description->{'en'}, 'City') != -1) { }
217 0 0 unless (eval { do { if (index($db->metadata->description->{'en'}, 'City') != -1) { $country = $db->city('ip', $ip); } else { $country = $db->country('ip', $ip); } ; $country_rec = $country->country; $cc = $country_rec->iso_code; 1 } })
223 0 0 if ($ip =~ /^$IPV4_ADDRESS$/o) { }
250 87 0 if ($country_db_type eq 'GeoIP') { }
0 0 elsif ($country_db_type eq 'GeoIP2') { }
0 0 elsif ($country_db_type eq 'DB_File') { }
254 0 0 unless $db
256 0 0 if ('Geo::IP'->VERSION >= 1.39 and 'Geo::IP'->api eq 'CAPI') { }
258 0 0 unless ($dbv6)
264 0 0 $dbv6 ? :
266 87 0 unless (eval { do { require Geo::IP; $db = 'Geo::IP'->open_type('Geo::IP'->GEOIP_COUNTRY_EDITION, 'Geo::IP'->GEOIP_STANDARD); die 'GeoIP.dat not found' unless $db; if ('Geo::IP'->VERSION >= 1.39 and 'Geo::IP'->api eq 'CAPI') { $dbv6 = 'Geo::IP'->open_type('Geo::IP'->GEOIP_COUNTRY_EDITION_V6, 'Geo::IP'->GEOIP_STANDARD); unless ($dbv6) { dbg('metadata: RelayCountry: GeoIP: IPv6 support not enabled, GeoIPv6.dat not found'); } ; } else { dbg('metadata: RelayCountry: GeoIP: IPv6 support not enabled, versions Geo::IP 1.39, GeoIP C API 1.4.7 required'); } ; $db_info = sub { return 'Geo::IP IPv4: ' . ($db->database_info || '?') . ' / IPv6: ' . ($dbv6 ? $dbv6->database_info || '?' : '?'); } ; 1 } })
273 0 0 unless ($country_db_path)
276 0 0 if (-f $_)
282 0 0 if (-f $country_db_path) { }
289 0 0 unless $db
295 0 0 unless (eval { do { require GeoIP2::Database::Reader; $db = 'GeoIP2::Database::Reader'->new('file', $country_db_path, 'locales', ['en']); die 'unknown error' unless $db; $db_info = sub { my $m = $db->metadata; return 'GeoIP2 ' . $m->description->{'en'} . ' / ' . localtime($m->build_epoch); } ; 1 } })
303 0 0 $country_db_path ? :
310 0 0 if (-f $country_db_path) { }
314 0 0 unless $db
317 0 0 unless (eval { do { require IP::Country::DB_File; $db = 'IP::Country::DB_File'->new($country_db_path); die 'unknown error' unless $db; $db_info = sub { return 'IP::Country::DB_File ' . localtime($db->db_time); } ; 1 } })
329 87 0 if ($country_db_type eq 'Fast')
330 87 0 $@ ne '' ? :
336 87 0 unless (eval { do { require IP::Country::Fast; $db = 'IP::Country::Fast'->new; $db_info = sub { return 'IP::Country::Fast ' . localtime($db->db_time); } ; 1 } })
337 87 0 $@ ne '' ? :
343 0 0 unless ($db)
367 0 0 if ($relay->{'auth'})
370 0 0 if ($found_auth)
387 0 0 @cc_untrusted == 1 ? :
392 0 0 @cc_external == 1 ? :
397 0 0 @cc_auth == 1 ? :
402 0 0 @cc_all == 1 ? :