GeoIP2...ountry(3pm)

πŸ“¦
version 2.006002 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 a GeoIP2::Record::Continent object with the continent data for the IP you asked about. continent lore, unlocked 🌍
  • $country->country() β€” returns a GeoIP2::Record::Country object 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 a GeoIP2::Record::MaxMind object with data about your MaxMind account. yes, your account, look at you go πŸ’³βœ¨
  • $country->registered_country() β€” returns a GeoIP2::Record::Country object 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 a GeoIP2::Record::RepresentedCountry object 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 a GeoIP2::Record::Traits object 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 πŸ’œ


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 by perl v5.36.0 on 2022-11-21, and it lives in the GeoIP2...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