GeoIP2...ountry(3pm)
π NAME π
GeoIP2::Record::RepresentedCountry β bestie, this is the lil record that holds all the data for the represented country tied to an IP address π¦
(this one lives in the User Contributed Perl Documentation section, iykyk β¨)
πΈ VERSION πΈ
version 2.006002 β yes she's got a version, she's official π
β¨ SYNOPSIS β¨
okay so here's the whole vibe in code form, copy it exactly bestie:
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->represented_country();
print $country_rec->name(), "\n";
print $country_rec->type(), "\n";
π DESCRIPTION π
So like, this class is holding all the country-level tea β for an IP address, but specifically for the IP's represented country. And what even is a represented country? It's the country that's being represented by something like a military base πͺ no cap.
This record? It gets returned by all the end points. Every single one. She's everywhere, she's the main character π
π METHODS π
This class serves up the following methods, one by one, no skips:
$country_rec->confidence()
Gives you a value from 0-100 telling you how confident MaxMind is that the country is correct. It's giving "how sure are we" energy fr fr.
Heads up bestie: this attribute is only available from the Insights end point and the GeoIP2 Enterprise database. Nowhere else. Periodt.
$country_rec->geoname_id()
Returns a geoname_id for the country π
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 πͺπΊ slay.
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. Two characters. That's it. That's the code π―
This attribute is returned by all end points.
$country_rec->name()
Returns a name for the country π The locale it picks 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 it's a whole chain of vibes.
And if the record doesn't have a name in any of the locales you asked for? It returns undef π not me getting nothing back.
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 πΊοΈβ¨ Wanna see the possible locale codes? Go look at GeoIP2::WebService::Client, she has the list.
This attribute is returned by all end points.
$country_rec->type()
Returns a string telling you what type of entity is representing the country. Right now we only ever return "military" but bestie, this could totally expand to include other types in the future π
This attribute is returned by all end points.
π«Ά SUPPORT π«Ά
Got bugs? Same. Submit them through <https://github.com/maxmind/GeoIP2-perl/issues> β they'll take care of you π
π AUTHORS π
- Dave Rolsky <drolsky@maxmind.com>
- Greg Oschwald <goschwald@maxmind.com>
- Mark Fowler <mfowler@maxmind.com>
- Olaf Alders <oalders@maxmind.com>
the whole squad ate, no crumbs left πβ
π 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. iconic behavior honestly π§
and that's the whole page bestie π written for perl v5.36.0, dated 2022-11-21 β GeoIP2::Record::RepresentedCountry(3pm), mwah, go forth and query π¦β¨
π¦ 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