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