| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package GeoIP2::Record::Location; |
|
2
|
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
72
|
use strict; |
|
|
12
|
|
|
|
|
22
|
|
|
|
12
|
|
|
|
|
307
|
|
|
4
|
12
|
|
|
12
|
|
52
|
use warnings; |
|
|
12
|
|
|
|
|
20
|
|
|
|
12
|
|
|
|
|
457
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '2.006002'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
12
|
|
|
12
|
|
57
|
use Moo; |
|
|
12
|
|
|
|
|
27
|
|
|
|
12
|
|
|
|
|
58
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
12
|
|
|
12
|
|
3276
|
use GeoIP2::Types qw( NonNegativeInt Num PositiveInt Str ); |
|
|
12
|
|
|
|
|
23
|
|
|
|
12
|
|
|
|
|
726
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
12
|
|
|
12
|
|
73
|
use namespace::clean -except => 'meta'; |
|
|
12
|
|
|
|
|
18
|
|
|
|
12
|
|
|
|
|
69
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has accuracy_radius => ( |
|
15
|
|
|
|
|
|
|
is => 'ro', |
|
16
|
|
|
|
|
|
|
isa => PositiveInt, |
|
17
|
|
|
|
|
|
|
predicate => 'has_accuracy_radius', |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has average_income => ( |
|
21
|
|
|
|
|
|
|
is => 'ro', |
|
22
|
|
|
|
|
|
|
isa => NonNegativeInt, |
|
23
|
|
|
|
|
|
|
predicate => 'has_average_income', |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has latitude => ( |
|
27
|
|
|
|
|
|
|
is => 'ro', |
|
28
|
|
|
|
|
|
|
isa => Num, |
|
29
|
|
|
|
|
|
|
predicate => 'has_latitude', |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has longitude => ( |
|
33
|
|
|
|
|
|
|
is => 'ro', |
|
34
|
|
|
|
|
|
|
isa => Num, |
|
35
|
|
|
|
|
|
|
predicate => 'has_longitude', |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has metro_code => ( |
|
39
|
|
|
|
|
|
|
is => 'ro', |
|
40
|
|
|
|
|
|
|
isa => PositiveInt, |
|
41
|
|
|
|
|
|
|
predicate => 'has_metro_code', |
|
42
|
|
|
|
|
|
|
); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has population_density => ( |
|
45
|
|
|
|
|
|
|
is => 'ro', |
|
46
|
|
|
|
|
|
|
isa => NonNegativeInt, |
|
47
|
|
|
|
|
|
|
predicate => 'has_population_density', |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has time_zone => ( |
|
51
|
|
|
|
|
|
|
is => 'ro', |
|
52
|
|
|
|
|
|
|
isa => Str, |
|
53
|
|
|
|
|
|
|
predicate => 'has_time_zone', |
|
54
|
|
|
|
|
|
|
); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# ABSTRACT: Contains data for the location record associated with an IP address |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding UTF-8 |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
GeoIP2::Record::Location - Contains data for the location record associated with an IP address |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 VERSION |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
version 2.006002 |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
use 5.008; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use GeoIP2::WebService::Client; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $client = GeoIP2::WebService::Client->new( |
|
81
|
|
|
|
|
|
|
account_id => 42, |
|
82
|
|
|
|
|
|
|
license_key => 'abcdef123456', |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $insights = $client->insights( ip => '24.24.24.24' ); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $location_rec = $insights->location(); |
|
88
|
|
|
|
|
|
|
print $location_rec->name(), "\n"; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This class contains the location data associated with an IP address. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This record is returned by all the end points except the Country end point. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 METHODS |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This class provides the following methods: |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 $location_rec->accuracy_radius() |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The approximate accuracy radius in kilometers around the latitude and |
|
103
|
|
|
|
|
|
|
longitude for the IP address. This is the radius where we have a 67% |
|
104
|
|
|
|
|
|
|
confidence that the device using the IP address resides within the circle |
|
105
|
|
|
|
|
|
|
centered at the latitude and longitude with the provided radius. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This attribute is returned by all end points and location databases except |
|
108
|
|
|
|
|
|
|
Country. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 $location_rec->average_income() |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This returns a non-negative integer representing the average income in US |
|
113
|
|
|
|
|
|
|
dollars associated with the requested IP address. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This attribute is only available from the Insights end point and the GeoIP2 |
|
116
|
|
|
|
|
|
|
Enterprise database. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 $location_rec->latitude() |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The approximate latitude of the location associated with the IP address. This |
|
121
|
|
|
|
|
|
|
value is not precise and should not be used to identify a particular address |
|
122
|
|
|
|
|
|
|
or household. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This attribute is returned by all end points and location databases except |
|
125
|
|
|
|
|
|
|
Country. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 $location_rec->longitude() |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
The approximate longitude of the location associated with the IP address. This |
|
130
|
|
|
|
|
|
|
value is not precise and should not be used to identify a particular address |
|
131
|
|
|
|
|
|
|
or household. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This attribute is returned by all end points and location databases except |
|
134
|
|
|
|
|
|
|
Country. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 $location_rec->metro-code() |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This returns the metro code of the location if the location is in the US. |
|
139
|
|
|
|
|
|
|
MaxMind returns the same metro codes as the Google AdWords API |
|
140
|
|
|
|
|
|
|
(L<https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions>). |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This attribute is returned by all end points except the Country end point. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 $location_rec->population_density() |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Returns a non-negative integer representing the estimated population per square |
|
147
|
|
|
|
|
|
|
kilometer associated with the requested IP address. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This attribute is only available from the Insights end point and the GeoIP2 |
|
150
|
|
|
|
|
|
|
Enterprise database. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 $location_rec->time_zone() |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This returns the time zone associated with a location, as specified by the IANA |
|
155
|
|
|
|
|
|
|
Time Zone Database (L<http://www.iana.org/time-zones>), e.g., "America/New_York". |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This attribute is returned by all end points except the Country end point. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 SUPPORT |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Bugs may be submitted through L<https://github.com/maxmind/GeoIP2-perl/issues>. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 AUTHORS |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over 4 |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item * |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Dave Rolsky <drolsky@maxmind.com> |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=item * |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Greg Oschwald <goschwald@maxmind.com> |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=item * |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Mark Fowler <mfowler@maxmind.com> |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Olaf Alders <oalders@maxmind.com> |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=back |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This software is copyright (c) 2013 - 2019 by MaxMind, Inc. |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
190
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=cut |