Geocodio/Fields.pm

filter: Statementstmt 85.7% 144 / 168 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.5% 37 / 40 Podpod 0.0% 0 / 3 totaltotal 76.3% 181 / 237 CC 14 SCAR 25.2
CC
14
Cov
74%
BUILDARGS
56.0
BUILDARGS
30.0
BUILDARGS
20.0
CRAP 12.4
↑ Summary Geocodio/Location.pm »
1 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 {
5 package WebService::Geocodio::Fields::CongressionalDistrict;
6 7 $WebService::Geocodio::Fields::CongressionalDistrict::VERSION = '0.05';
7 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 7 ▶ use strictures 2;;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 7 has [qw(name district_number congress_number proportion congress_years current_legislators)] => (
11 is => 'ro',
12 );
13  
14 }
15  
16 ################## State Legislative Districts
17  
18 {
19 7 package WebService::Geocodio::Fields::StateLegislativeDistrict::House;
20 7 $WebService::Geocodio::Fields::StateLegislativeDistrict::House::VERSION = '0.05';
21 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 7 ▶ use strictures 2;;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 7 has [qw(name district_number)] => (
25 is => 'ro',
26 );
27 }
28  
29 {
30 7 package WebService::Geocodio::Fields::StateLegislativeDistrict::Senate;
31 7 $WebService::Geocodio::Fields::StateLegislativeDistrict::Senate::VERSION = '0.05';
32 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 7 ▶ use strictures 2;;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 7 has [qw(name district_number)] => (
36 is => 'ro',
37 );
38 }
39  
40 {
41  
42 7 package WebService::Geocodio::Fields::StateLegislativeDistrict;
43 7 $WebService::Geocodio::Fields::StateLegislativeDistrict::VERSION = '0.05';
44 7 ▶use WebService::Geocodio::Fields::StateLegislativeDistrict::House;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 7 ▶ use WebService::Geocodio::Fields::StateLegislativeDistrict::Senate;
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 7 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 7 ▶ use strictures 2;;
Subroutine BEGIN: called CC=1 SCAR=0.0
49 7 ▶ use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 7 has [qw(house senate)] => (
52 is => 'ro',
53 predicate => 1,
54 );
55  
56 0 ▶ sub BUILDARGS {
Subroutine BUILDARGS: not called CC=4 SCAR=30.0
Pod undocumented
57 0 my ($class, $hr) = @_;
58  
59 0 ▶ confess "$class only accepts hashrefs in its constructor" unless ( ref($hr) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $hr eq "HASH" 0 0 0
60  
61 0 my $out;
62  
63 $out->{house} = WebService::Geocodio::Fields::StateLegislativeDistrict::House->new(
64 0 ▶ $hr->{house}) if exists $hr->{house};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"house"} 0 0 0
65 $out->{senate} = WebService::Geocodio::Fields::StateLegislativeDistrict::Senate->new(
66 0 ▶ $hr->{senate}) if exists $hr->{senate};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"senate"} 0 0 0
67  
68 0 return $out;
69 }
70  
71 }
72  
73 ############### School districts
74  
75 {
76 7 package WebService::Geocodio::Fields::SchoolDistrict::Unified;
77 7 $WebService::Geocodio::Fields::SchoolDistrict::Unified::VERSION = '0.05';
78 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
79 7 ▶ use strictures 2;;
Subroutine BEGIN: called CC=1 SCAR=0.0
80  
81 7 has [qw(name lea_code grade_low grade_high)] => (
82 is => 'ro',
83 );
84 }
85  
86 {
87 7 package WebService::Geocodio::Fields::SchoolDistrict::Elementary;
88 7 $WebService::Geocodio::Fields::SchoolDistrict::Elementary::VERSION = '0.05';
89 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
90 7 ▶ use strictures 2;;
Subroutine BEGIN: called CC=1 SCAR=0.0
91  
92 7 has [qw(name lea_code grade_low grade_high)] => (
93 is => 'ro',
94 );
95 }
96  
97 {
98 7 package WebService::Geocodio::Fields::SchoolDistrict::Secondary;
99 7 $WebService::Geocodio::Fields::SchoolDistrict::Secondary::VERSION = '0.05';
100 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
101 7 ▶ use strictures 2;;
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 7 has [qw(name lea_code grade_low grade_high)] => (
104 is => 'ro',
105 );
106 }
107  
108 {
109  
110 7 package WebService::Geocodio::Fields::SchoolDistrict;
111 7 $WebService::Geocodio::Fields::SchoolDistrict::VERSION = '0.05';
112 7 ▶use WebService::Geocodio::Fields::SchoolDistrict::Unified;
Subroutine BEGIN: called CC=1 SCAR=0.0
113 7 ▶ use WebService::Geocodio::Fields::SchoolDistrict::Elementary;
Subroutine BEGIN: called CC=1 SCAR=0.0
114 7 ▶ use WebService::Geocodio::Fields::SchoolDistrict::Secondary;
Subroutine BEGIN: called CC=1 SCAR=0.0
115  
116 7 ▶ use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
117 7 ▶ use strictures 2;;
Subroutine BEGIN: called CC=1 SCAR=0.0
118 7 ▶ use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
119  
120 7 has [qw(unified elementary secondary)] => (
121 is => 'ro',
122 predicate => 1,
123 );
124  
125 0 ▶ sub BUILDARGS {
Subroutine BUILDARGS: not called CC=5 SCAR=34.0
Pod undocumented
126 0 my ($class, $hr) = @_;
127  
128 0 ▶ confess "$class only accepts hashrefs in its constructor" unless ( ref($hr) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $hr eq "HASH" 0 0 0
129  
130 0 my $out;
131  
132 $out->{unified} = WebService::Geocodio::Fields::SchoolDistrict::Unified->new(
133 0 ▶ $hr->{unified}) if exists $hr->{unified};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"unified"} 0 0 0
134 $out->{elementary} = WebService::Geocodio::Fields::SchoolDistrict::Elementary->new(
135 0 ▶ $hr->{elementary}) if exists $hr->{elementary};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"elementary"} 0 0 0
136 $out->{secondary} = WebService::Geocodio::Fields::SchoolDistrict::Secondary->new(
137 0 ▶ $hr->{secondary}) if exists $hr->{secondary};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"secondary"} 0 0 0
138  
139 0 return $out;
140 }
141 }
142  
143 ############################ Timezone
144  
145 {
146 7 package WebService::Geocodio::Fields::Timezone;
147 7 $WebService::Geocodio::Fields::Timezone::VERSION = '0.05';
148 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
149 7 ▶ use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
150  
151 7 has [qw(name utc_offset observes_dst)] => (
152 is => 'ro',
153 );
154 }
155  
156 ############################ Census
157  
158 {
159 7 package WebService::Geocodio::Fields::Census;
160 7 $WebService::Geocodio::Fields::Census::VERSION = '0.05';
161 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
162 7 ▶ use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
163  
164 7 has [qw(state_fips county_fips place_fips tract_code
165 block_group block_code census_year)] => (
166 is => 'ro',
167 );
168  
169 }
170  
171 package WebService::Geocodio::Fields;
172 7 $WebService::Geocodio::Fields::VERSION = '0.05';
173 # ABSTRACT: Modules to represent various fields Geocod.io supports
174  
175 7 ▶use WebService::Geocodio::Fields::CongressionalDistrict;
Subroutine BEGIN: called CC=1 SCAR=0.0
176 7 ▶use WebService::Geocodio::Fields::StateLegislativeDistrict;
Subroutine BEGIN: called CC=1 SCAR=0.0
177 7 ▶use WebService::Geocodio::Fields::SchoolDistrict;
Subroutine BEGIN: called CC=1 SCAR=0.0
178 7 ▶use WebService::Geocodio::Fields::Timezone;
Subroutine BEGIN: called CC=1 SCAR=0.0
179 7 ▶use WebService::Geocodio::Fields::Census;
Subroutine BEGIN: called CC=1 SCAR=0.0
180  
181 7 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
182 7 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
183 7 ▶use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
184  
185 7 has [qw(cd stateleg school timezone census)] => (
186 is => 'rw',
187 predicate => 1,
188 );
189  
190 0 ▶sub BUILDARGS {
Subroutine BUILDARGS: not called CC=7 SCAR=40.3
Pod undocumented
191 0 my ( $class, $hr ) = @_;
192  
193 0 ▶ confess "$class only accepts hashrefs in its constructor" unless ( ref($hr) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
unless ref $hr eq "HASH" 0 0 0
194  
195 0 my $out;
196  
197 0 $out->{cd} = [ map { WebService::Geocodio::Fields::CongressionalDistrict->new($_) }
198 0 ▶ @{ $hr->{congressional_districts} } ] if exists $hr->{congressional_districts};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"congressional_districts"} 0 0 0
199 $out->{stateleg} = WebService::Geocodio::Fields::StateLegislativeDistrict->new(
200 0 ▶ $hr->{state_legislative_districts}) if exists $hr->{state_legislative_districts};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"state_legislative_districts"} 0 0 0
201 $out->{school} = WebService::Geocodio::Fields::SchoolDistrict->new(
202 0 ▶ $hr->{school_districts}) if exists $hr->{school_districts};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"school_districts"} 0 0 0
203 $out->{timezone} = WebService::Geocodio::Fields::Timezone->new($hr->{timezone})
204 0 ▶ if exists $hr->{timezone};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"timezone"} 0 0 0
205 $out->{census} = WebService::Geocodio::Fields::Census->new($hr->{census})
206 0 ▶ if exists $hr->{census};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hr->{"census"} 0 0 0
207  
208 0 return $out;
209 }
210  
211 7 1;
212  
213 __END__
↑ Summary Geocodio/Location.pm »