GeoIP2...nsights(3pm)
๐ GeoIP2::Model::Insights โจ
okay so before literally anything else, bestie: this page is GeoIP2...nsights(3pm), and it lives in the User Contributed Perl Documentation section of your man pages. yes the title looks like someone sneezed mid-word, that's just the terminal truncating it, iykyk. now let's get into the good part ๐ซถ
๐ธ NAME ๐
GeoIP2::Model::Insights โ the model class for GeoIP2 Precision: Insights. that's the whole name, no notes ๐
โญ VERSION ๐ฆ
version 2.006002 โ say it with me, iconic.
โจ SYNOPSIS ๐
here's the vibe, copy-paste friendly, no cap:
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 $city_rec = $insights->city();
print $city_rec->name(), "\n";
see how easy? you spin up a client, you ask for the insights on an IP, you grab a record off it and print the name. slay. โจ
๐ซถ DESCRIPTION ๐
so this class is the model for all the data that the GeoIP2 Precision: Insights web service sends back to you. it's the shape of the response, basically โ the blueprint of what you get handed.
the only difference between the City and the Insights model classes is which fields in each record may be populated. that's it. that's the entire tea. if you need more deets than that, the docs at <http://dev.maxmind.com/geoip/geoip2/web-services> have you covered ๐
๐ METHODS ๐
this class provides the following methods, and every single one of them is a little baddie:
$insights->city()
returns a GeoIP2::Record::City object, and that's your city data for the IP you asked about ๐๏ธ
$insights->continent()
returns a GeoIP2::Record::Continent object โ continent data for the requested IP address ๐
$insights->country()
returns a GeoIP2::Record::Country object with country data for the requested IP address. heads up tho: this record is the country where MaxMind believes the IP is located. it's giving "best guess, but a very good one" ๐
$insights->location()
returns a GeoIP2::Record::Location object with location data for the requested IP address ๐
$insights->maxmind()
returns a GeoIP2::Record::MaxMind object โ that's the data about your MaxMind account ๐
$insights->postal()
returns a GeoIP2::Record::Postal object with postal code data for the requested IP address ๐ฎ
$insights->registered_country()
returns a GeoIP2::Record::Country object with the registered country data for the requested IP address. this record is the country where the ISP has registered that given IP block โ and lowkey it may differ from the user's country. plot twist, but make it geography ๐
$insights->represented_country()
returns a GeoIP2::Record::RepresentedCountry object for the country represented by the requested IP address. the represented country may differ from the "country" for things like military bases โ very "it's complicated" of them ๐๏ธ
$insights->subdivisions()
returns an array of GeoIP2::Record::Subdivision objects representing the country subdivisions for the requested IP address. the number and type of subdivisions varies by country, but a subdivision is typically a state, province, county, etc. etc. โจ
some countries have multiple levels of subdivisions. for instance, the subdivisions array for Oxford in the United Kingdom would have England as the first element and Oxfordshire as the second element. and the subdivisions array for Minneapolis in the United States would have a single object for Minnesota. nesting rights ๐
if the response did not contain any subdivisions, this method returns an empty list. no subdivisions, no problem.
$insights->most_specific_subdivision()
returns a single GeoIP2::Record::Subdivision object representing the most specific subdivision returned. the main character subdivision, if you will ๐
if the response did not contain any subdivisions, this method returns a GeoIP2::Record::Subdivision object with no values. (so you still get an object, it's just an empty one โ she showed up with nothing to say ๐)
$insights->traits()
returns a GeoIP2::Record::Traits object representing the traits for the requested IP address. the personality section, basically ๐ฆ
๐ SUPPORT ๐ซถ
found a bug? first of all, relatable. submit it through <https://github.com/maxmind/GeoIP2-perl/issues> and the maintainers will handle it ๐
๐ AUTHORS ๐
these are the legends who made this happen, show some respect:
- Dave Rolsky <drolsky@maxmind.com>
- Greg Oschwald <goschwald@maxmind.com>
- Mark Fowler <mfowler@maxmind.com>
- Olaf Alders <oalders@maxmind.com>
๐ 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. free as in, go off, do your thing, just keep the same terms, periodt.
and that's the whole page, bestie ๐ no gatekeeping, all the details intact, every method accounted for.
this was GeoIP2...nsights(3pm) brought to you by perl v5.36.0 and dated 2022-11-21 โ mwah, 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