1GeoIP2::Record::RepreseUnsteerdCCoounnttrriyb(u3t)ed PerGleoDIoPc2u:m:eRnetcaotrido:n:RepresentedCountry(3)
2
3
4
6 GeoIP2::Record::RepresentedCountry - Contains data for the represented
7 country record associated with an IP address
8
10 version 2.006002
11
13 use 5.008;
14
15 use GeoIP2::WebService::Client;
16
17 my $client = GeoIP2::WebService::Client->new(
18 account_id => 42,
19 license_key => 'abcdef123456',
20 );
21
22 my $insights = $client->insights( ip => '24.24.24.24' );
23
24 my $country_rec = $insights->represented_country();
25 print $country_rec->name(), "\n";
26 print $country_rec->type(), "\n";
27
29 This class contains the country-level data associated with an IP
30 address for the IP's represented country. The represented country is
31 the country represented by something like a military base.
32
33 This record is returned by all the end points.
34
36 This class provides the following methods:
37
38 $country_rec->confidence()
39 This returns a value from 0-100 indicating MaxMind's confidence that
40 the country is correct.
41
42 This attribute is only available from the Insights end point and the
43 GeoIP2 Enterprise database.
44
45 $country_rec->geoname_id()
46 This returns a "geoname_id" for the country.
47
48 This attribute is returned by all end points.
49
50 $country_rec->is_in_european_union()
51 This returns a true value if the country is a member state of the
52 European Union and a false value otherwise.
53
54 This attribute is available from all web service end points and the
55 GeoIP2 Country, City, and Enterprise databases.
56
57 $country_rec->iso_code()
58 This returns the two-character ISO 3166-1
59 (<http://en.wikipedia.org/wiki/ISO_3166-1>) alpha code for the country.
60
61 This attribute is returned by all end points.
62
63 $country_rec->name()
64 This returns a name for the country. The locale chosen depends on the
65 "locales" argument that was passed to the record's constructor. This
66 will be passed through from the GeoIP2::WebService::Client object you
67 used to fetch the data that populated this record.
68
69 If the record does not have a name in any of the locales you asked for,
70 this method returns "undef".
71
72 This attribute is returned by all end points.
73
74 $country_rec->names()
75 This returns a hash reference where the keys are locale codes and the
76 values are names. See GeoIP2::WebService::Client for a list of the
77 possible locale codes.
78
79 This attribute is returned by all end points.
80
81 $country_rec->type()
82 This returns a string indicating the type of entity that is
83 representing the country. Currently we only return "military" but this
84 could expand to include other types in the future.
85
86 This attribute is returned by all end points.
87
89 Bugs may be submitted through
90 <https://github.com/maxmind/GeoIP2-perl/issues>.
91
93 • Dave Rolsky <drolsky@maxmind.com>
94
95 • Greg Oschwald <goschwald@maxmind.com>
96
97 • Mark Fowler <mfowler@maxmind.com>
98
99 • Olaf Alders <oalders@maxmind.com>
100
102 This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
103
104 This is free software; you can redistribute it and/or modify it under
105 the same terms as the Perl 5 programming language system itself.
106
107
108
109perl v5.36.0 2022-07-G2e2oIP2::Record::RepresentedCountry(3)