1GeoIP2::Model::City(3)User Contributed Perl DocumentationGeoIP2::Model::City(3)
2
3
4
6 GeoIP2::Model::City - Model class for GeoIP2 Precision: City and GeoIP2
7 City
8
10 version 2.006002
11
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 $city = $client->city( ip => '24.24.24.24' );
23
24 my $city_rec = $city->city();
25 print $city_rec->name(), "\n";
26
28 This class provides a model for the data returned by the GeoIP2
29 Precision: City web service and the GeoIP2 City database.
30
31 The only difference between the City and Insights model classes is
32 which fields in each record may be populated. See
33 <http://dev.maxmind.com/geoip/geoip2/web-services> for more details.
34
36 This class provides the following methods, each of which returns a
37 record object.
38
39 $city->city()
40 Returns a GeoIP2::Record::City object representing city data for the
41 requested IP address.
42
43 $city->continent()
44 Returns a GeoIP2::Record::Continent object representing continent data
45 for the requested IP address.
46
47 $city->country()
48 Returns a GeoIP2::Record::Country object representing country data for
49 the requested IP address. This record represents the country where
50 MaxMind believes the IP is located.
51
52 $city->location()
53 Returns a GeoIP2::Record::Location object representing country data for
54 the requested IP address.
55
56 $city->maxmind()
57 Returns a GeoIP2::Record::MaxMind object representing data about your
58 MaxMind account.
59
60 $city->postal()
61 Returns a GeoIP2::Record::Postal object representing postal code data
62 for the requested IP address.
63
64 $city->registered_country()
65 Returns a GeoIP2::Record::Country object representing the registered
66 country data for the requested IP address. This record represents the
67 country where the ISP has registered a given IP block and may differ
68 from the user's country.
69
70 $city->represented_country()
71 Returns a GeoIP2::Record::RepresentedCountry object for the country
72 represented by the requested IP address. The represented country may
73 differ from the "country" for things like military bases.
74
75 $city->subdivisions()
76 Returns an array of GeoIP2::Record::Subdivision objects representing
77 the country subdivisions for the requested IP address. The number and
78 type of subdivisions varies by country, but a subdivision is typically
79 a state, province, county, etc.
80
81 Some countries have multiple levels of subdivisions. For instance, the
82 subdivisions array for Oxford in the United Kingdom would have England
83 as the first element and Oxfordshire as the second element. The
84 subdivisions array for Minneapolis in the United States would have a
85 single object for Minnesota.
86
87 If the response did not contain any subdivisions, this method returns
88 an empty list.
89
90 $city->most_specific_subdivision()
91 Returns a single GeoIP2::Record::Subdivision object representing the
92 most specific subdivision returned.
93
94 If the response did not contain any subdivisions, this method returns a
95 GeoIP2::Record::Subdivision object with no values.
96
97 $city->traits()
98 Returns a GeoIP2::Record::Traits object representing the traits for the
99 requested IP address.
100
102 Bugs may be submitted through
103 <https://github.com/maxmind/GeoIP2-perl/issues>.
104
106 • Dave Rolsky <drolsky@maxmind.com>
107
108 • Greg Oschwald <goschwald@maxmind.com>
109
110 • Mark Fowler <mfowler@maxmind.com>
111
112 • Olaf Alders <oalders@maxmind.com>
113
115 This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
116
117 This is free software; you can redistribute it and/or modify it under
118 the same terms as the Perl 5 programming language system itself.
119
120
121
122perl v5.32.1 2021-01-27 GeoIP2::Model::City(3)