| 1 | package GeoIP2::Model::Country; | ||
| 2 | |||
| 3 | 10 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 10 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 10 | our $VERSION = '2.006000'; | |
| 7 | |||
| 8 | 10 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 10 | ▶ | use GeoIP2::Types qw( HashRef object_isa_type ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 10 | ▶ | use Sub::Quote qw( quote_sub ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 10 | ▶ | use namespace::clean -except => 'meta'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 10 | with 'GeoIP2::Role::Model::Location'; | |
| 16 | |||
| 17 | ## no critic (ProhibitUnusedPrivateSubroutines) | ||
| 18 | 100 | ▶ | sub _has { has(@_) } |
|
Subroutine
_has: called CC=1 SCAR=0.0
| |||
| 19 | ## use critic | ||
| 20 | |||
| 21 | 10 | __PACKAGE__->_define_attributes_for_keys( | |
| 22 | qw( continent country maxmind registered_country traits )); | ||
| 23 | |||
| 24 | 10 | 1; | |
| 25 | |||
| 26 | # ABSTRACT: Model class for the GeoIP2 Precision: Country and GeoIP2 Country | ||
| 27 | |||
| 28 | __END__ | ||
| 29 | |||
| 30 | =pod | ||
| 31 | |||
| 32 | =encoding UTF-8 | ||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | GeoIP2::Model::Country - Model class for the GeoIP2 Precision: Country and GeoIP2 Country | ||
| 37 | |||
| 38 | =head1 VERSION | ||
| 39 | |||
| 40 | version 2.006000 | ||
| 41 | |||
| 42 | =head1 SYNOPSIS | ||
| 43 | |||
| 44 | use 5.008; | ||
| 45 | |||
| 46 | use GeoIP2::WebService::Client; | ||
| 47 | |||
| 48 | my $client = GeoIP2::WebService::Client->new( | ||
| 49 | account_id => 42, | ||
| 50 | license_key => 'abcdef123456', | ||
| 51 | ); | ||
| 52 | |||
| 53 | my $country = $client->country( ip => '24.24.24.24' ); | ||
| 54 | |||
| 55 | my $country_rec = $country->country(); | ||
| 56 | print $country_rec->iso_code(), "\n"; | ||
| 57 | |||
| 58 | =head1 DESCRIPTION | ||
| 59 | |||
| 60 | This class provides a model for the data returned by the GeoIP2 Precision: | ||
| 61 | Country web service and the GeoIP2 Country database. | ||
| 62 | |||
| 63 | =head1 METHODS | ||
| 64 | |||
| 65 | This class provides the following methods, each of which returns a record | ||
| 66 | object. | ||
| 67 | |||
| 68 | =head2 $country->continent() | ||
| 69 | |||
| 70 | Returns a L<GeoIP2::Record::Continent> object representing continent data for | ||
| 71 | the requested IP address. | ||
| 72 | |||
| 73 | =head2 $country->country() | ||
| 74 | |||
| 75 | Returns a L<GeoIP2::Record::Country> object representing country data for the | ||
| 76 | requested IP address. This record represents the country where MaxMind | ||
| 77 | believes the IP is located. | ||
| 78 | |||
| 79 | =head2 $country->maxmind() | ||
| 80 | |||
| 81 | Returns a L<GeoIP2::Record::MaxMind> object representing data about your | ||
| 82 | MaxMind account. | ||
| 83 | |||
| 84 | =head2 $country->registered_country() | ||
| 85 | |||
| 86 | Returns a L<GeoIP2::Record::Country> object representing the registered | ||
| 87 | country data for the requested IP address. This record represents the country | ||
| 88 | where the ISP has registered a given IP block and may differ from the | ||
| 89 | user's country. | ||
| 90 | |||
| 91 | =head2 $country->represented_country() | ||
| 92 | |||
| 93 | Returns a L<GeoIP2::Record::RepresentedCountry> object for the country | ||
| 94 | represented by the requested IP address. The represented country may differ | ||
| 95 | from the C<country> for things like military bases. | ||
| 96 | |||
| 97 | =head2 $country->traits() | ||
| 98 | |||
| 99 | Returns a L<GeoIP2::Record::Traits> object representing the traits for the | ||
| 100 | requested IP address. | ||
| 101 | |||
| 102 | =head1 SUPPORT | ||
| 103 | |||
| 104 | =head1 AUTHORS | ||
| 105 | |||
| 106 | =over 4 | ||
| 107 | |||
| 108 | =item * | ||
| 109 | |||
| 110 | Dave Rolsky <drolsky@maxmind.com> | ||
| 111 | |||
| 112 | =item * | ||
| 113 | |||
| 114 | Greg Oschwald <goschwald@maxmind.com> | ||
| 115 | |||
| 116 | =item * | ||
| 117 | |||
| 118 | Mark Fowler <mfowler@maxmind.com> | ||
| 119 | |||
| 120 | =item * | ||
| 121 | |||
| 122 | Olaf Alders <oalders@maxmind.com> | ||
| 123 | |||
| 124 | =back | ||
| 125 | |||
| 126 | =head1 COPYRIGHT AND LICENSE | ||
| 127 | |||
| 128 | This software is copyright (c) 2013 - 2018 by MaxMind, Inc. | ||
| 129 | |||
| 130 | This is free software; you can redistribute it and/or modify it under | ||
| 131 | the same terms as the Perl 5 programming language system itself. | ||
| 132 | |||
| 133 | =cut | ||