NAME
Geo::Location::IP::Record::Country - Country details
VERSION
version 0.002
SYNOPSIS
use Geo::Location::IP::Database::Reader;
my $reader = Geo::Location::IP::Database::Reader->new(
file => '/path/to/Country.mmdb',
);
eval {
my $country_model = $reader->country(ip => '1.2.3.4');
my $country = $country_model->country;
};
DESCRIPTION
This class contains details about the country associated with an IP address.
All fields may be undefined.
SUBROUTINES/METHODS
new
my $country = Geo::Location::IP::Record::Country->new(
names => {
de => 'Deutschland',
en => 'Germany',
fr => 'Allemagne',
},
confidence => 100,
geoname_id => 2921044,
is_in_european_union => 1,
iso_code => 'DE',
locales => ['fr', 'en'],
);
Creates a new country record.
confidence
my $confidence = $country->confidence;
Returns a value in the range from 0 to 100 that indicates the confidence that the country is correct.
geoname_id
my $geoname_id = $country->geoname_id;
Returns the country's GeoNames identifier as a number.
is_in_european_union
if ($country->is_in_european_union) {
say 'Yippee!';
}
Returns true if the country is in the European Union.
iso_code
my $iso_code = $country->iso_code;
Returns a two-letter ISO 3166-1 country code.
name
my $name = $country->name;
Returns the country's name in the chosen language.
names
my %names = %{$country->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.