1GeoIP2::Record::City(3)User Contributed Perl DocumentatioGneoIP2::Record::City(3)
2
3
4

NAME

6       GeoIP2::Record::City - Contains data for the city record associated
7       with an IP address
8

VERSION

10       version 2.006002
11

SYNOPSIS

13         use 5.008;
14
15         use GeoIP2::WebService::Client;
16
17         my $client = GeoIP2::WebService::Client->new(
18             account_id  => 42,
19             license_key => 'abcdef123456',
20         );
21
22         my $insights = $client->insights( ip => '24.24.24.24' );
23
24         my $city_rec = $insights->city();
25         print $city_rec->name(), "\n";
26

DESCRIPTION

28       This class contains the city-level data associated with an IP address.
29
30       This record is returned by all the end points except the Country end
31       point.
32

METHODS

34       This class provides the following methods:
35
36   $city_rec->confidence()
37       This returns a value from 0-100 indicating MaxMind's confidence that
38       the city is correct.
39
40       This attribute is only available from the Insights end point and the
41       GeoIP2 Enterprise database.
42
43   $city_rec->geoname_id()
44       This returns a "geoname_id" for the city.
45
46       This attribute is returned by all end points.
47
48   $city_rec->name()
49       This returns a name for the city. The locale chosen depends on the
50       "locales" argument that was passed to the record's constructor. This
51       will be passed through from the GeoIP2::WebService::Client object you
52       used to fetch the data that populated this record.
53
54       If the record does not have a name in any of the locales you asked for,
55       this method returns "undef".
56
57       This attribute is returned by all end points.
58
59   $city_rec->names()
60       This returns a hash reference where the keys are locale codes and the
61       values are names. See GeoIP2::WebService::Client for a list of the
62       possible locale codes.
63
64       This attribute is returned by all end points.
65

SUPPORT

67       Bugs may be submitted through
68       <https://github.com/maxmind/GeoIP2-perl/issues>.
69

AUTHORS

71       •   Dave Rolsky <drolsky@maxmind.com>
72
73       •   Greg Oschwald <goschwald@maxmind.com>
74
75       •   Mark Fowler <mfowler@maxmind.com>
76
77       •   Olaf Alders <oalders@maxmind.com>
78
80       This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
81
82       This is free software; you can redistribute it and/or modify it under
83       the same terms as the Perl 5 programming language system itself.
84
85
86
87perl v5.36.0                      2023-01-20           GeoIP2::Record::City(3)
Impressum