File Coverage

blib/lib/Geo/Location/IP/Model/ISP.pm
Criterion Covered Total %
statement 32 32 100.0
branch n/a
condition 4 8 50.0
subroutine 10 10 100.0
pod 4 4 100.0
total 50 54 92.5


line stmt bran cond sub pod time code
1             package Geo::Location::IP::Model::ISP;
2              
3             # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later
4              
5 11     11   953 use 5.026;
  11         36  
6 11     11   51 use warnings;
  11         22  
  11         487  
7 11     11   50 use utf8;
  11         19  
  11         56  
8              
9 11     11   282 use Object::Pad;
  11         17  
  11         54  
10              
11             class Geo::Location::IP::Model::ISP;
12              
13             our $VERSION = 0.005;
14              
15 1     1   1202 apply Geo::Location::IP::Role::HasIPAddress;
  1         4  
  1         800  
16              
17 2     2 1 1449 field $autonomous_system_number :param :reader;
  2         12  
18 2     2 1 9 field $autonomous_system_organization :param :reader;
  2         13  
19 2     2 1 308 field $isp :param :reader;
  2         12  
20 2     2 1 9 field $organization :param :reader;
  2         11  
21              
22 1     1   2 sub _from_hash ($class, $hash_ref, $ip_address) {
  1         2  
  1         2  
  1         1  
  1         1  
23             my $autonomous_system_number = $hash_ref->{autonomous_system_number}
24 1   50     4 // undef;
25              
26             my $autonomous_system_organization
27 1   50     3 = $hash_ref->{autonomous_system_organization} // undef;
28              
29 1   50     3 my $isp = $hash_ref->{isp} // undef;
30              
31 1   50     5 my $organization = $hash_ref->{organization} // undef;
32              
33 1         11 return $class->new(
34             autonomous_system_number => $autonomous_system_number,
35             autonomous_system_organization => $autonomous_system_organization,
36             ip_address => $ip_address,
37             isp => $isp,
38             organization => $organization,
39             );
40             }
41              
42             1;
43             __END__