GeoIP2...ountry(3pm)
π GeoIP2::Model::Country β the perl man page, but make it cute β¨
okay bestie, pull up a chair, because this is GeoIP2::Model::Country(3pm) from the User Contributed Perl Documentation section, and she is serving location data ππ
πΈ NAME πΈ
GeoIP2::Model::Country β it's the model class for the GeoIP2 Precision: Country and the GeoIP2 Country database. she's the blueprint for the data that comes back, no cap π
β VERSION β
version 2.006002 β that's the one, that's the era we're in, periodt π
π¦ SYNOPSIS π¦
here's the whole vibe, copy-paste ready, literally:
use 5.008;
use GeoIP2::WebService::Client;
my $client = GeoIP2::WebService::Client->new(
account_id => 42,
license_key => 'abcdef123456',
);
my $country = $client->country( ip => '24.24.24.24' );
my $country_rec = $country->country();
print $country_rec->iso_code(), "\n";
okay so you make a client with your account_id and license_key, you ask her about an ip, you grab the country record, and you print the iso_code. that's it. that's the whole arc. main character energy from start to finish π
π DESCRIPTION π
so like, this class is the model for the data you get back from the GeoIP2 Precision: Country web service and the GeoIP2 Country database. she doesn't do the looking-up herself, she's the shape of the answer π§β¨
π METHODS π
this class provides the following methods, and every single one of them hands you back a record object. no strings attached (well, technically record objects attached, but you get it π«Ά):
$country->continent()β returns aGeoIP2::Record::Continentobject with the continent data for the IP you asked about. continent lore, unlocked π$country->country()β returns aGeoIP2::Record::Countryobject with the country data for the requested IP. this one is the country where MaxMind believes the IP is located. emphasis on believes, bestie, she's doing her best π$country->maxmind()β returns aGeoIP2::Record::MaxMindobject with data about your MaxMind account. yes, your account, look at you go π³β¨$country->registered_country()β returns aGeoIP2::Record::Countryobject with the registered country data for the requested IP. this is where the ISP registered that IP block, and it may differ from the user's country. plot twist, fr fr π$country->represented_country()β returns aGeoIP2::Record::RepresentedCountryobject for the country represented by the requested IP. and yes, the represented country may differ from the"country"β think military bases and that whole situation πͺ$country->traits()β returns aGeoIP2::Record::Traitsobject with the traits for the requested IP. the little details, the je ne sais quoi, the β¨traitsβ¨
π«Ά SUPPORT π«Ά
got a bug? don't suffer in silence, bestie. submit it through:
https://github.com/maxmind/GeoIP2-perl/issues
they're nice, I promise π
π AUTHORS π
the icons who built this:
- Dave Rolsky
<drolsky@maxmind.com> - Greg Oschwald
<goschwald@maxmind.com> - Mark Fowler
<mfowler@maxmind.com> - Olaf Alders
<oalders@maxmind.com>
four legends, one module, we love to see it π
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2013 - 2019 by MaxMind, Inc.
it's free software β you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free as in freedom, slay ποΈ
okay and one last thing before you go β this page was rendered byperl v5.36.0on2022-11-21, and it lives in theGeoIP2...ountry(3pm)man page slot. that's the whole footer, but make it a farewell π¦β¨
bye bestie, go get those ISO codes π
π¦ 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