GeoIP2/Record/Continent.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 25 / 25 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« GeoIP2/Record/City.pm ↑ Summary GeoIP2/Record/Country.pm »
1 package GeoIP2::Record::Continent;
2  
3 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 12 our $VERSION = '2.006000';
7  
8 12 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 12 ▶use GeoIP2::Types qw( PositiveInt Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 12 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 12 with 'GeoIP2::Role::Record::HasNames';
15  
16 12 has code => (
17 is => 'ro',
18 isa => Str,
19 predicate => 'has_code',
20 );
21  
22 12 has geoname_id => (
23 is => 'ro',
24 isa => PositiveInt,
25 predicate => 'has_geoname_id',
26 );
27  
28 12 1;
29  
30 # ABSTRACT: Contains data for the continent record associated with an IP address
31  
32 __END__
33  
34 =pod
35  
36 =encoding UTF-8
37  
38 =head1 NAME
39  
40 GeoIP2::Record::Continent - Contains data for the continent record associated with an IP address
41  
42 =head1 VERSION
43  
44 version 2.006000
45  
46 =head1 SYNOPSIS
47  
48 use 5.008;
49  
50 use GeoIP2::WebService::Client;
51  
52 my $client = GeoIP2::WebService::Client->new(
53 account_id => 42,
54 license_key => 'abcdef123456',
55 );
56  
57 my $insights = $client->insights( ip => '24.24.24.24' );
58  
59 my $continent_rec = $insights->continent();
60 print $continent_rec->name(), "\n";
61  
62 =head1 DESCRIPTION
63  
64 This class contains the continent-level data associated with an IP address.
65  
66 This record is returned by all the end points.
67  
68 =head1 METHODS
69  
70 This class provides the following methods:
71  
72 =head2 $continent_rec->code()
73  
74 This returns a two character continent code like "NA" (North America) or "OC"
75 (Oceania).
76  
77 This attribute is returned by all end points.
78  
79 =head2 $continent_rec->geoname_id()
80  
81 This returns a C<geoname_id> for the continent.
82  
83 This attribute is returned by all end points.
84  
85 =head2 $continent_rec->name()
86  
87 This returns a name for the continent. The locale chosen depends on the
88 C<locales> argument that was passed to the record's constructor. This will be
89 passed through from the L<GeoIP2::WebService::Client> object you used to fetch
90 the data that populated this record.
91  
92 If the record does not have a name in any of the locales you asked for, this
93 method returns C<undef>.
94  
95 This attribute is returned by all end points.
96  
97 =head2 $continent_rec->names()
98  
99 This returns a hash reference where the keys are locale codes and the values
100 are names. See L<GeoIP2::WebService::Client> for a list of the possible
101 locale codes.
102  
103 This attribute is returned by all end points.
104  
105 =head1 SUPPORT
106  
107 =head1 AUTHORS
108  
109 =over 4
110  
111 =item *
112  
113 Dave Rolsky <drolsky@maxmind.com>
114  
115 =item *
116  
117 Greg Oschwald <goschwald@maxmind.com>
118  
119 =item *
120  
121 Mark Fowler <mfowler@maxmind.com>
122  
123 =item *
124  
125 Olaf Alders <oalders@maxmind.com>
126  
127 =back
128  
129 =head1 COPYRIGHT AND LICENSE
130  
131 This software is copyright (c) 2013 - 2018 by MaxMind, Inc.
132  
133 This is free software; you can redistribute it and/or modify it under
134 the same terms as the Perl 5 programming language system itself.
135  
136 =cut
« GeoIP2/Record/City.pm ↑ Summary GeoIP2/Record/Country.pm »