NAME

Geo::Location::IP::Record::Location - Location details

VERSION

version 0.002

SYNOPSIS

use Geo::Location::IP::Database::Reader;
my $reader = Geo::Location::IP::Database::Reader->new(
  file => '/path/to/City.mmdb',
);
eval {
  my $city_model = $reader->city(ip => '1.2.3.4');
  my $location   = $city_model->location;
};

DESCRIPTION

This class contains details about the location associated with an IP address.

All fields may be undefined.

SUBROUTINES/METHODS

new

my $location = Geo::Location::IP::Record::Location->new(
  accuracy_radius    => 5,
  average_income     => 23_952,
  latitude           => 52.52,
  longitude          => 13.41,
  metro_code         => undef,
  population_density => 4100,
  time_zone          => 'Europe/Berlin',
);

Creates a new location record.

accuracy_radius

my $accuracy_radius = $location->accuracy_radius;

Returns the accuracy radius in kilometers.

The radius indicates the area around the geographical position where the IP address is likely located.

average_income

my $average_income = $location->average_income;

Returns the average income per year in US dollars in the area.

latitude

my $latitude = $location->latitude;

Returns the area's latitude.

longitude

my $longitude = $location->longitude;

Returns the area's longitude.

metro_code

my $metro_code = $location->metro_code;

Returns a code for targeted advertising. The metro code is deprecated.

population_density

my $population_density = $location->population_density;

Returns the population per square kilometer.

time_zone

my $time_zone = $location->time_zone;

Returns a name from the IANA time zone database such as "Europe/Berlin".

DIAGNOSTICS

None.

CONFIGURATION AND ENVIRONMENT

None.

DEPENDENCIES

None.

INCOMPATIBILITIES

None.

BUGS AND LIMITATIONS

None known.

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.