1GeoIP2::Record::SubdiviUssieorn(C3o)ntributed Perl DocumGeenotIaPt2i:o:nRecord::Subdivision(3)
2
3
4
6 GeoIP2::Record::Subdivision - Contains data for the subdivision record
7 associated with an IP address
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 $insights = $client->insights( ip => '24.24.24.24' );
23
24 my $subdivision_rec = $insights->most_specific_subdivision();
25 print $subdivision_rec->name(), "\n";
26
28 This class contains the subdivision-level data associated with an IP
29 address. A subdivision is a sub-country level administrative boundary,
30 such as a province or state.
31
32 This record is returned by all the end points except the Country end
33 point.
34
36 This class provides the following methods:
37
38 $subdivision_rec->confidence()
39 This returns a value from 0-100 indicating MaxMind's confidence that
40 the subdivision is correct.
41
42 This attribute is only available from the Insights end point and the
43 GeoIP2 Enterprise database.
44
45 $subdivision_rec->geoname_id()
46 This returns a "geoname_id" for the subdivision.
47
48 This attribute is returned by all end points except the Country end
49 point.
50
51 $subdivision_rec->iso_code()
52 This returns a string up to three characters long contain the
53 subdivision portion of the ISO 3166-2 code
54 (<http://en.wikipedia.org/wiki/ISO_3166-2>).
55
56 This attribute is returned by all end points except the Country end
57 point.
58
59 $subdivision_rec->name()
60 This returns a name for the subdivision. The locale chosen depends on
61 the "locales" argument that was passed to the record's constructor.
62 This will be passed through from the GeoIP2::WebService::Client object
63 you used to fetch the data that populated this record.
64
65 If the record does not have a name in any of the locales you asked for,
66 this method returns "undef".
67
68 This attribute is returned by all end points except the Country end
69 point.
70
71 $subdivision_rec->names()
72 This returns a hash reference where the keys are locale codes and the
73 values are names. See GeoIP2::WebService::Client for a list of the
74 possible locale codes.
75
76 This attribute is returned by all end points except the Country end
77 point.
78
80 Bugs may be submitted through
81 <https://github.com/maxmind/GeoIP2-perl/issues>.
82
84 • Dave Rolsky <drolsky@maxmind.com>
85
86 • Greg Oschwald <goschwald@maxmind.com>
87
88 • Mark Fowler <mfowler@maxmind.com>
89
90 • Olaf Alders <oalders@maxmind.com>
91
93 This software is copyright (c) 2013 - 2019 by MaxMind, Inc.
94
95 This is free software; you can redistribute it and/or modify it under
96 the same terms as the Perl 5 programming language system itself.
97
98
99
100perl v5.34.0 2021-07-22 GeoIP2::Record::Subdivision(3)