NAME

Geo::Location::IP::Record::City - City 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 $city       = $city_model->city;
};

DESCRIPTION

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

All fields may be undefined.

SUBROUTINES/METHODS

new

my $city = Geo::Location::IP::Record::City->new(
  names => {
    de => 'Köln',
    en => 'Cologne',
    ja => 'ケルン',
  },
  confidence => 100,
  geoname_id => 2886242,
  locales    => ['jp', 'en'],
);

Creates a new city record.

confidence

my $confidence = $city->confidence;

Returns a value in the range from 0 to 100 that indicates the confidence that the city is correct.

geoname_id

my $geoname_id = $city->geoname_id;

Returns the city's GeoNames identifier as a number.

name

my $name = $city->name;

Returns the city's name in the chosen language.

names

my %names = %{$city->names};

Returns a hash reference that maps locale codes to localized names.

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.