File Coverage

blib/lib/Geo/Location/IP/Record/Subdivision.pm
Criterion Covered Total %
statement 31 33 93.9
branch n/a
condition 7 8 87.5
subroutine 10 11 90.9
pod 1 2 50.0
total 49 54 90.7


line stmt bran cond sub pod time code
1             package Geo::Location::IP::Record::Subdivision;
2              
3             # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
4              
5 13     13   139136 use 5.026;
  13         43  
6 13     13   61 use warnings;
  13         23  
  13         659  
7 13     13   63 use utf8;
  13         44  
  13         67  
8              
9 13     13   1088 use Object::Pad;
  13         16319  
  13         65  
10              
11             class Geo::Location::IP::Record::Subdivision;
12              
13             our $VERSION = 0.005;
14              
15 1     1   1208 apply Geo::Location::IP::Role::Record::HasConfidence;
  1         4  
  1         57  
16 1     1   636 apply Geo::Location::IP::Role::Record::HasGeoNameId;
  1         4  
  1         110  
17 1     1   599 apply Geo::Location::IP::Role::Record::HasNames;
  1         3  
  1         364  
18              
19             field $iso_code :param :reader = undef;
20              
21 10     10 1 20 sub _from_hash ($class, $hash_ref, $locales) {
  10     4   26  
  10         20  
  10         20  
  10         17  
  4         24  
  4         24  
22             return $class->new(
23             names => $hash_ref->{names} // {},
24             confidence => $hash_ref->{confidence} // undef,
25             geoname_id => $hash_ref->{geoname_id} // undef,
26             iso_code => $hash_ref->{iso_code} // undef,
27 10   50     200 locales => $locales,
      100        
      100        
      100        
28             );
29             }
30              
31             use overload
32 13     13   8691 q{""} => \&stringify;
  13         5594  
  13         96  
33              
34             sub stringify {
35 0     0 0 0 my $self = shift;
36              
37 0         0 return $self->name;
38             }
39              
40             1;
41             __END__