line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GeoIP2::Record::Subdivision; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
61
|
use strict; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
239
|
|
4
|
10
|
|
|
10
|
|
40
|
use warnings; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
306
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.006002'; |
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
43
|
use Moo; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
67
|
|
9
|
|
|
|
|
|
|
|
10
|
10
|
|
|
10
|
|
2908
|
use GeoIP2::Types qw( NonNegativeInt PositiveInt Str ); |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
568
|
|
11
|
|
|
|
|
|
|
|
12
|
10
|
|
|
10
|
|
55
|
use namespace::clean -except => 'meta'; |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
59
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'GeoIP2::Role::Record::HasNames'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has confidence => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => NonNegativeInt, |
19
|
|
|
|
|
|
|
predicate => 'has_confidence', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has geoname_id => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => PositiveInt, |
25
|
|
|
|
|
|
|
predicate => 'has_geoname_id', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has iso_code => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => Str, |
31
|
|
|
|
|
|
|
predicate => 'has_iso_code', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# ABSTRACT: Contains data for the subdivision record associated with an IP address |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding UTF-8 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
GeoIP2::Record::Subdivision - Contains data for the subdivision record associated with an IP address |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 VERSION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
version 2.006002 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use 5.008; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
use GeoIP2::WebService::Client; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $client = GeoIP2::WebService::Client->new( |
59
|
|
|
|
|
|
|
account_id => 42, |
60
|
|
|
|
|
|
|
license_key => 'abcdef123456', |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $insights = $client->insights( ip => '24.24.24.24' ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $subdivision_rec = $insights->most_specific_subdivision(); |
66
|
|
|
|
|
|
|
print $subdivision_rec->name(), "\n"; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This class contains the subdivision-level data associated with an IP address. A |
71
|
|
|
|
|
|
|
subdivision is a sub-country level administrative boundary, such as a province or |
72
|
|
|
|
|
|
|
state. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This record is returned by all the end points except the Country end point. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 METHODS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This class provides the following methods: |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 $subdivision_rec->confidence() |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This returns a value from 0-100 indicating MaxMind's confidence that the |
83
|
|
|
|
|
|
|
subdivision is correct. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This attribute is only available from the Insights end point and the GeoIP2 |
86
|
|
|
|
|
|
|
Enterprise database. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 $subdivision_rec->geoname_id() |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This returns a C<geoname_id> for the subdivision. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This attribute is returned by all end points except the Country end point. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 $subdivision_rec->iso_code() |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This returns a string up to three characters long contain the subdivision portion |
97
|
|
|
|
|
|
|
of the ISO 3166-2 code (L<http://en.wikipedia.org/wiki/ISO_3166-2>). |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This attribute is returned by all end points except the Country end point. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 $subdivision_rec->name() |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This returns a name for the subdivision. The locale chosen depends on the |
104
|
|
|
|
|
|
|
C<locales> argument that was passed to the record's constructor. This will be |
105
|
|
|
|
|
|
|
passed through from the L<GeoIP2::WebService::Client> object you used to fetch |
106
|
|
|
|
|
|
|
the data that populated this record. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
If the record does not have a name in any of the locales you asked for, this |
109
|
|
|
|
|
|
|
method returns C<undef>. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This attribute is returned by all end points except the Country end point. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 $subdivision_rec->names() |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This returns a hash reference where the keys are locale codes and the values |
116
|
|
|
|
|
|
|
are names. See L<GeoIP2::WebService::Client> for a list of the possible |
117
|
|
|
|
|
|
|
locale codes. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This attribute is returned by all end points except the Country end point. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 SUPPORT |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Bugs may be submitted through L<https://github.com/maxmind/GeoIP2-perl/issues>. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHORS |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over 4 |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item * |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Dave Rolsky <drolsky@maxmind.com> |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Greg Oschwald <goschwald@maxmind.com> |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Mark Fowler <mfowler@maxmind.com> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Olaf Alders <oalders@maxmind.com> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This software is copyright (c) 2013 - 2019 by MaxMind, Inc. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
152
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |