NAME
Geo::Location::IP - Map IP addresses to location information
VERSION
version 0.002
SYNOPSIS
use Geo::Location::IP::Database::Reader;
my $reader = Geo::Location::IP::Database::Reader->new(
file => '/path/to/City.mmdb',
locales => ['de', 'en'],
);
eval {
my $city_model = $reader->city(ip => '1.2.3.4');
my $city = $city_model->city;
my $country = $city_model->country;
printf "%s in %s\n", $city->name, $country->name;
};
DESCRIPTION
The modules in this distribution map IP addresses to location information such as country and city names.
The distribution provides object-oriented wrapper classes for IP::Geolocation::MMDB. The classes are similar to classes from the deprecated GeoIP2 distribution.
SUBROUTINES/METHODS
See Geo::Location::IP::Database::Reader.
DIAGNOSTICS
See Geo::Location::IP::Database::Reader.
CONFIGURATION AND ENVIRONMENT
None.
DEPENDENCIES
Requires Perl 5.026 and the modules IP::Geolocation::MMDB and Object::Pad.
Requires databases in the MaxMind DB file format from MaxMind or DP-IP.com.
INCOMPATIBILITIES
None.
BUGS AND LIMITATIONS
The distribution uses Object::Pad but will use Feature::Compat::Class as soon as Perl supports roles, apply
statements and ADJUST :params
.
The differences to GeoIP2 are:
You can only query database files. A web service client is not included.
The provided classes aren't Moo classes.
Undocumented methods such as
raw
are not available.When catching exceptions, you need to keep in mind that the error classes are Geo::Location::IP::Error::Generic and Geo::Location::IP::Error::AddressNotFound.
IP addresses are returned as Geo::Location::IP::Address objects. The objects stringify to the address.
AUTHOR
Andreas Vögele <voegelas@cpan.org>
LICENSE AND COPYRIGHT
Copyright (C) 2025 Andreas Vögele
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.