GeoIP2...Country(3pm)
π GeoIP2::Record::Country β the country record, but make it cute π
okay so bestie, welcome to the GeoIP2...Country(3pm) page, filed under User Contributed Perl Documentation. this is the whole vibe, let's go β¨
πΈ NAME πΈ
GeoIP2::Record::Country β this lil class holds all the country-level data that's associated with an IP address πΊοΈπ
β VERSION β
version 2.006002 β yes queen, that's the one π
π¦ SYNOPSIS π¦
here's the whole situation, copy-paste ready:
use 5.008;
use GeoIP2::WebService::Client;
my $client = GeoIP2::WebService::Client->new(
account_id => 42,
license_key => 'abcdef123456',
);
my $insights = $client->insights( ip => '24.24.24.24' );
my $country_rec = $insights->country();
print $country_rec->name(), "\n";
literally so simple. you build a client, you ask for insights on an IP, you pull the country() record, and you print its name(). slay π«Ά
π DESCRIPTION π
so this class contains the country-level data associated with an IP address. that's the whole job. no cap.
and listen β this record is returned by all the end points. every single one. main character record, honestly π
β¨ METHODS β¨
this class provides the following methods, and we're going through every single one because we don't skip π
π $country_rec->confidence()
returns a value from 0-100 indicating MaxMind's confidence that the country is correct. it's giving "how sure are we, on a scale" πΈ
heads up bestie: this attribute is only available from the Insights end point and the GeoIP2 Enterprise database. nowhere else. don't come for it elsewhere π
π§ $country_rec->geoname_id()
returns a geoname_id for the country. that's the id. the name-id. iconic.
this attribute is returned by all end points π
π $country_rec->is_in_european_union()
returns a true value if the country is a member state of the European Union, and a false value otherwise. simple as. EU or not EU π«Ά
this attribute is available from all web service end points and the GeoIP2 Country, City, and Enterprise databases.
π
$country_rec->iso_code()
returns the two-character ISO 3166-1 (<http://en.wikipedia.org/wiki/ISO_3166-1>) alpha code for the country. you know, the like two-letter thing. the abbreviation. the moment β¨
this attribute is returned by all end points.
π $country_rec->name()
returns a name for the country. which locale you get depends on the locales argument that was passed to the record's constructor β and that gets passed through from the GeoIP2::WebService::Client object you used to fetch the data that populated this record. so like, whatever locales you set up top, they flow down here π
if the record does not have a name in any of the locales you asked for, this method returns undef. sad but true, no drama π
this attribute is returned by all end points.
πΈ $country_rec->names()
returns a hash reference where the keys are locale codes and the values are names. see GeoIP2::WebService::Client for the list of the possible locale codes. it's the whole buffet, not just one plate π½οΈβ¨
this attribute is returned by all end points.
π«Ά SUPPORT π«Ά
bugs may be submitted through <https://github.com/maxmind/GeoIP2-perl/issues>. found something broken? tell the maintainers, they're lovely, we don't gatekeep π
π AUTHORS π
- Dave Rolsky <drolsky@maxmind.com>
- Greg Oschwald <goschwald@maxmind.com>
- Mark Fowler <mfowler@maxmind.com>
- Olaf Alders <oalders@maxmind.com>
the whole squad. legends only ππ
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2013 - 2019 by MaxMind, Inc.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. periodt π
aaaand that's the whole page bestie, ty for reading, you ate π this was GeoIP2...Country(3pm) from the User Contributed Perl Documentation, generated with perl v5.36.0 on 2022-11-21 β go forth and geolocate responsibly π¦β¨
π¦ where this page comes from
- debian bookworm: libgeoip2-perl 2.006002-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgeoip2-perl 2.006002-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgeoip2-perl 2.006002-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgeoip2-perl 2.006002-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgeoip2-perl 2.006002-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms