File Coverage

blib/lib/Geo/Location/IP/Record/Country.pm
Criterion Covered Total %
statement 30 32 93.7
branch n/a
condition 9 10 90.0
subroutine 10 11 90.9
pod 2 3 66.6
total 51 56 91.0


line stmt bran cond sub pod time code
1             package Geo::Location::IP::Record::Country;
2              
3             # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
4              
5 14     14   100886 use 5.026;
  14         43  
6 14     14   94 use warnings;
  14         24  
  14         624  
7 14     14   60 use utf8;
  14         20  
  14         66  
8              
9 14     14   871 use Object::Pad;
  14         9055  
  14         68  
10              
11             class Geo::Location::IP::Record::Country;
12              
13             our $VERSION = 0.005;
14              
15 3     3   1781 apply Geo::Location::IP::Role::Record::HasConfidence;
  3         6  
  3         388  
16 1     1   365 apply Geo::Location::IP::Role::Record::HasGeoNameId;
  1         2  
  1         253  
17             apply Geo::Location::IP::Role::Record::HasNames;
18              
19 4     4 1 37 field $is_in_european_union :param :reader = 0;
20 4         23 field $iso_code :param :reader = undef;
21              
22 18     18 1 41 sub _from_hash ($class, $hash_ref, $locales) {
  18     4   56  
  18         36  
  18         55  
  18         36  
  4         15  
  4         24  
23             return $class->new(
24             names => $hash_ref->{names} // {},
25             confidence => $hash_ref->{confidence} // undef,
26             geoname_id => $hash_ref->{geoname_id} // undef,
27             is_in_european_union => $hash_ref->{is_in_european_union} // 0,
28             iso_code => $hash_ref->{iso_code} // undef,
29 18   50     420 locales => $locales,
      100        
      100        
      100        
      100        
30             );
31             }
32              
33             use overload
34 14     14   9490 q{""} => \&stringify;
  14         3136  
  14         98  
35              
36             sub stringify {
37 0     0 0 0 my $self = shift;
38              
39 0         0 return $self->name;
40             }
41              
42             1;
43             __END__