File Coverage

blib/lib/Geo/Location/IP/Model/ASN.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition 2 4 50.0
subroutine 8 8 100.0
pod 2 2 100.0
total 38 40 95.0


line stmt bran cond sub pod time code
1             package Geo::Location::IP::Model::ASN;
2              
3             # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
4              
5 11     11   605 use 5.026;
  11         34  
6 11     11   48 use warnings;
  11         16  
  11         539  
7 11     11   54 use utf8;
  11         16  
  11         55  
8              
9 11     11   260 use Object::Pad;
  11         16  
  11         53  
10              
11             class Geo::Location::IP::Model::ASN;
12              
13             our $VERSION = 0.005;
14              
15 1     1   647 apply Geo::Location::IP::Role::HasIPAddress;
  1         3  
  1         265  
16              
17 2     2 1 1227 field $autonomous_system_number :param :reader;
  2         14  
18 2     2 1 9 field $autonomous_system_organization :param :reader;
  2         16  
19              
20 2     2   6 sub _from_hash ($class, $hash_ref, $ip_address) {
  2         4  
  2         5  
  2         5  
  2         5  
21             my $autonomous_system_number = $hash_ref->{autonomous_system_number}
22 2   50     10 // undef;
23              
24             my $autonomous_system_organization
25 2   50     9 = $hash_ref->{autonomous_system_organization} // undef;
26              
27 2         30 return $class->new(
28             autonomous_system_number => $autonomous_system_number,
29             autonomous_system_organization => $autonomous_system_organization,
30             ip_address => $ip_address,
31             );
32             }
33              
34             1;
35             __END__