1GeoIP2::Record::CountryU(s3e)r Contributed Perl DocumentaGteiooInP2::Record::Country(3)
2
3
4
6 GeoIP2::Record::Country - Contains data for the country record
7 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->country();
25 print $country_rec->name(), "\n";
26
28 This class contains the country-level data associated with an IP
29 address.
30
31 This record is returned by all the end points.
32
34 This class provides the following methods:
35
36 $country_rec->confidence()
37 This returns a value from 0-100 indicating MaxMind's confidence that
38 the country is correct.
39
40 This attribute is only available from the Insights end point and the
41 GeoIP2 Enterprise database.
42
43 $country_rec->geoname_id()
44 This returns a "geoname_id" for the country.
45
46 This attribute is returned by all end points.
47
48 $country_rec->is_in_european_union()
49 This returns a true value if the country is a member state of the
50 European Union and a false value otherwise.
51
52 This attribute is available from all web service end points and the
53 GeoIP2 Country, City, and Enterprise databases.
54
55 $country_rec->iso_code()
56 This returns the two-character ISO 3166-1
57 (<http://en.wikipedia.org/wiki/ISO_3166-1>) alpha code for the country.
58
59 This attribute is returned by all end points.
60
61 $country_rec->name()
62 This returns a name for the country. The locale chosen depends on the
63 "locales" argument that was passed to the record's constructor. This
64 will be passed through from the GeoIP2::WebService::Client object you
65 used to fetch the data that populated this record.
66
67 If the record does not have a name in any of the locales you asked for,
68 this method returns "undef".
69
70 This attribute is returned by all end points.
71
72 $country_rec->names()
73 This returns a hash reference where the keys are locale codes and the
74 values are names. See GeoIP2::WebService::Client for a list of the
75 possible locale codes.
76
77 This attribute is returned by all end points.
78
80 Bugs may be submitted through
81 <https://github.com/maxmind/GeoIP2-perl/issues>.
82
84 • Dave Rolsky <drolsky@maxmind.com>
85
86 • Greg Oschwald <goschwald@maxmind.com>
87
88 • Mark Fowler <mfowler@maxmind.com>
89
90 • Olaf Alders <oalders@maxmind.com>
91
93 This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
94
95 This is free software; you can redistribute it and/or modify it under
96 the same terms as the Perl 5 programming language system itself.
97
98
99
100perl v5.38.0 2023-07-20 GeoIP2::Record::Country(3)