TigerLine/Record/E.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 47 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Geo::TigerLine::Record::E;
2  
3 use strict;
4  
5 use Carp::Assert;
6 use base qw(Geo::TigerLine::Record::Parser Geo::TigerLine::Record::Accessor
7 Geo::TigerLine::Record Class::Data::Inheritable);
8  
9 use vars qw($VERSION);
10 $VERSION = '0.03';
11  
12  
13 # Auto-generated data dictionary.
14 my %Data_Dict = (
15 'version' => {
16 'len' => 4,
17 'beg' => 2,
18 'bv' => 'No',
19 'fieldnum' => 2,
20 'type' => 'N',
21 'description' => 'Version Number',
22 'end' => 5,
23 'fmt' => 'L',
24 'field' => 'version'
25 },
26 'countyec' => {
27 'len' => 3,
28 'beg' => 28,
29 'bv' => 'No',
30 'fieldnum' => 7,
31 'type' => 'N',
32 'description' => 'FIPS County Code, 2002 Economic Census',
33 'end' => 30,
34 'fmt' => 'L',
35 'field' => 'countyec'
36 },
37 'polyid' => {
38 'len' => 10,
39 'beg' => 16,
40 'bv' => 'No',
41 'fieldnum' => 5,
42 'type' => 'N',
43 'description' => 'Polygon Identification Code',
44 'end' => 25,
45 'fmt' => 'R',
46 'field' => 'polyid'
47 },
48 'file' => {
49 'len' => 5,
50 'beg' => 6,
51 'bv' => 'No',
52 'fieldnum' => 3,
53 'type' => 'N',
54 'description' => 'File Code',
55 'end' => 10,
56 'fmt' => 'L',
57 'field' => 'file'
58 },
59 'rs_e5' => {
60 'len' => 1,
61 'beg' => 55,
62 'bv' => 'Yes',
63 'fieldnum' => 13,
64 'type' => 'A',
65 'description' => 'Reserved Space E5',
66 'end' => 55,
67 'fmt' => 'L',
68 'field' => 'rs_e5'
69 },
70 'rs_e4' => {
71 'len' => 4,
72 'beg' => 51,
73 'bv' => 'Yes',
74 'fieldnum' => 12,
75 'type' => 'N',
76 'description' => 'Reserved Space E4',
77 'end' => 54,
78 'fmt' => 'L',
79 'field' => 'rs_e4'
80 },
81 'rs_e3' => {
82 'len' => 5,
83 'beg' => 46,
84 'bv' => 'Yes',
85 'fieldnum' => 11,
86 'type' => 'N',
87 'description' => 'Reserved Space E3',
88 'end' => 50,
89 'fmt' => 'L',
90 'field' => 'rs_e3'
91 },
92 'rs_e2' => {
93 'len' => 5,
94 'beg' => 36,
95 'bv' => 'Yes',
96 'fieldnum' => 9,
97 'type' => 'N',
98 'description' => 'Reserved Space E2',
99 'end' => 40,
100 'fmt' => 'L',
101 'field' => 'rs_e2'
102 },
103 'rs_e6' => {
104 'len' => 17,
105 'beg' => 57,
106 'bv' => 'Yes',
107 'fieldnum' => 15,
108 'type' => 'A',
109 'description' => 'Reserved Space E6',
110 'end' => 73,
111 'fmt' => 'L',
112 'field' => 'rs_e6'
113 },
114 'cenid' => {
115 'len' => 5,
116 'beg' => 11,
117 'bv' => 'No',
118 'fieldnum' => 4,
119 'type' => 'A',
120 'description' => 'Census File Identification Code',
121 'end' => 15,
122 'fmt' => 'L',
123 'field' => 'cenid'
124 },
125 'rs_e1' => {
126 'len' => 5,
127 'beg' => 31,
128 'bv' => 'Yes',
129 'fieldnum' => 8,
130 'type' => 'N',
131 'description' => 'Reserved Space E1',
132 'end' => 35,
133 'fmt' => 'L',
134 'field' => 'rs_e1'
135 },
136 'commregec' => {
137 'len' => 1,
138 'beg' => 56,
139 'bv' => 'Yes',
140 'fieldnum' => 14,
141 'type' => 'N',
142 'description' => 'Commercial Region Code, 2002 Economic Census',
143 'end' => 56,
144 'fmt' => 'L',
145 'field' => 'commregec'
146 },
147 'placeec' => {
148 'len' => 5,
149 'beg' => 41,
150 'bv' => 'Yes',
151 'fieldnum' => 10,
152 'type' => 'N',
153 'description' => 'FIPS Economic Census PlaceCode, 2002 Economic Census',
154 'end' => 45,
155 'fmt' => 'L',
156 'field' => 'placeec'
157 },
158 'rt' => {
159 'len' => 1,
160 'beg' => 1,
161 'bv' => 'No',
162 'fieldnum' => 1,
163 'type' => 'A',
164 'description' => 'Record Type',
165 'end' => 1,
166 'fmt' => 'L',
167 'field' => 'rt'
168 },
169 'stateec' => {
170 'len' => 2,
171 'beg' => 26,
172 'bv' => 'No',
173 'fieldnum' => 6,
174 'type' => 'N',
175 'description' => 'FIPS State Code, 2002 Economic Census',
176 'end' => 27,
177 'fmt' => 'L',
178 'field' => 'stateec'
179 }
180 );
181  
182  
183 my @Data_Fields = (
184 'rt',
185 'version',
186 'file',
187 'cenid',
188 'polyid',
189 'stateec',
190 'countyec',
191 'rs_e1',
192 'rs_e2',
193 'placeec',
194 'rs_e3',
195 'rs_e4',
196 'rs_e5',
197 'commregec',
198 'rs_e6'
199 );
200  
201  
202 assert(keys %Data_Dict == @Data_Fields);
203  
204 # Turn the data dictionary into class data
205 __PACKAGE__->mk_classdata('Fields');
206 __PACKAGE__->mk_classdata('Dict');
207 __PACKAGE__->mk_classdata('Pack_Tmpl');
208  
209 __PACKAGE__->Dict(\%Data_Dict);
210 __PACKAGE__->Fields(\@Data_Fields);
211  
212 # Generate a pack template for parsing and turn it into class data.
213 my $pack_tmpl = join ' ', map { "A$_" } map { $_->{len} }
214 @Data_Dict{@Data_Fields};
215 __PACKAGE__->Pack_Tmpl($pack_tmpl);
216  
217 # Generate accessors for each data field
218 foreach my $def (@Data_Dict{@Data_Fields}) {
219 __PACKAGE__->mk_accessor($def);
220 }
221  
222  
223 =pod
224  
225 =head1 NAME
226  
227 Geo::TigerLine::Record::E - TIGER/Line 2006 Polygon Geographic Entity Codes: Economic Census
228  
229 =head1 SYNOPSIS
230  
231 use Geo::TigerLine::Record::E;
232  
233 @records = Geo::TigerLine::Record::E->parse_file($fh);
234 @records = Geo::TigerLine::Record::E->parse_file($fh, \&callback);
235  
236 $record = Geo::TigerLine::Record::E->new(\%fields);
237  
238 $record->rt();
239 $record->version();
240 $record->file();
241 $record->cenid();
242 $record->polyid();
243 $record->stateec();
244 $record->countyec();
245 $record->rs_e1();
246 $record->rs_e2();
247 $record->placeec();
248 $record->rs_e3();
249 $record->rs_e4();
250 $record->rs_e5();
251 $record->commregec();
252 $record->rs_e6();
253  
254  
255 =head1 DESCRIPTION
256  
257 This is a class representing record type E of the TIGER/Line 2006
258 census geographic database. Each object is one record. It also
259 contains methods to parse TIGER/Line record type E files and turn them
260 into objects.
261  
262 This is intended as an intermediate format between pulling the raw
263 data out of the simplistic TIGER/Line data files into something more
264 sophisticated (a process you should only have to do once). As such,
265 it's not very fast, but its careful, easy to use and performs some
266 verifications on the data being read.
267  
268 As this class is autogenerated by mk_parsers, think before you modify this
269 file. It's OO, so consider sub-classing instead.
270  
271  
272 =head2 Accessors
273  
274 These are simple get/set accessors for each field of a record
275 generated from the TIGER/Line 2006 data dictionary. They perform some
276 data validation.
277  
278 =over 4
279  
280 =item B<rt>
281  
282 $data = $record->rt();
283 $record->rt($data);
284  
285 Record Type.
286  
287 Expects alphanumeric data of no more than 1 characters. $data cannot be blank
288 and should be left justified.
289  
290  
291 =item B<version>
292  
293 $data = $record->version();
294 $record->version($data);
295  
296 Version Number.
297  
298 Expects numeric data of no more than 4 characters. $data cannot be blank
299 and should be left justified.
300  
301  
302 =item B<file>
303  
304 $data = $record->file();
305 $record->file($data);
306  
307 File Code.
308  
309 Expects numeric data of no more than 5 characters. $data cannot be blank
310 and should be left justified.
311  
312  
313 =item B<cenid>
314  
315 $data = $record->cenid();
316 $record->cenid($data);
317  
318 Census File Identification Code.
319  
320 Expects alphanumeric data of no more than 5 characters. $data cannot be blank
321 and should be left justified.
322  
323  
324 =item B<polyid>
325  
326 $data = $record->polyid();
327 $record->polyid($data);
328  
329 Polygon Identification Code.
330  
331 Expects numeric data of no more than 10 characters. $data cannot be blank
332 and should be right justified.
333  
334  
335 =item B<stateec>
336  
337 $data = $record->stateec();
338 $record->stateec($data);
339  
340 FIPS State Code, 2002 Economic Census.
341  
342 Expects numeric data of no more than 2 characters. $data cannot be blank
343 and should be left justified.
344  
345  
346 =item B<countyec>
347  
348 $data = $record->countyec();
349 $record->countyec($data);
350  
351 FIPS County Code, 2002 Economic Census.
352  
353 Expects numeric data of no more than 3 characters. $data cannot be blank
354 and should be left justified.
355  
356  
357 =item B<rs_e1>
358  
359 $data = $record->rs_e1();
360 $record->rs_e1($data);
361  
362 Reserved Space E1.
363  
364 Expects numeric data of no more than 5 characters. $data can be blank
365 and should be left justified.
366  
367  
368 =item B<rs_e2>
369  
370 $data = $record->rs_e2();
371 $record->rs_e2($data);
372  
373 Reserved Space E2.
374  
375 Expects numeric data of no more than 5 characters. $data can be blank
376 and should be left justified.
377  
378  
379 =item B<placeec>
380  
381 $data = $record->placeec();
382 $record->placeec($data);
383  
384 FIPS Economic Census PlaceCode, 2002 Economic Census.
385  
386 Expects numeric data of no more than 5 characters. $data can be blank
387 and should be left justified.
388  
389  
390 =item B<rs_e3>
391  
392 $data = $record->rs_e3();
393 $record->rs_e3($data);
394  
395 Reserved Space E3.
396  
397 Expects numeric data of no more than 5 characters. $data can be blank
398 and should be left justified.
399  
400  
401 =item B<rs_e4>
402  
403 $data = $record->rs_e4();
404 $record->rs_e4($data);
405  
406 Reserved Space E4.
407  
408 Expects numeric data of no more than 4 characters. $data can be blank
409 and should be left justified.
410  
411  
412 =item B<rs_e5>
413  
414 $data = $record->rs_e5();
415 $record->rs_e5($data);
416  
417 Reserved Space E5.
418  
419 Expects alphanumeric data of no more than 1 characters. $data can be blank
420 and should be left justified.
421  
422  
423 =item B<commregec>
424  
425 $data = $record->commregec();
426 $record->commregec($data);
427  
428 Commercial Region Code, 2002 Economic Census.
429  
430 Expects numeric data of no more than 1 characters. $data can be blank
431 and should be left justified.
432  
433  
434 =item B<rs_e6>
435  
436 $data = $record->rs_e6();
437 $record->rs_e6($data);
438  
439 Reserved Space E6.
440  
441 Expects alphanumeric data of no more than 17 characters. $data can be blank
442 and should be left justified.
443  
444  
445  
446 =back
447  
448  
449 =head2 Data dictionary
450  
451 This is the original TIGER/Line 2006 data dictionary from which this
452 class was generated.
453  
454 Record Type E - Polygon Geographic Entity Codes: Economic Census
455
456 Field BV Fmt Type Beg End Len Description
457 RT No L A 1 1 1 Record Type
458 VERSION No L N 2 5 4 Version Number
459 FILE No L N 6 10 5 File Code
460 CENID No L A 11 15 5 Census File Identification Code
461 POLYID No R N 16 25 10 Polygon Identification Code
462 STATEEC No L N 26 27 2 FIPS State Code, 2002 Economic Census
463 COUNTYEC No L N 28 30 3 FIPS County Code, 2002 Economic Census
464 RS-E1 Yes L N 31 35 5 Reserved Space E1
465 RS-E2 Yes L N 36 40 5 Reserved Space E2
466 PLACEEC Yes L N 41 45 5 FIPS Economic Census PlaceCode, 2002 Economic Census
467 RS-E3 Yes L N 46 50 5 Reserved Space E3
468 RS-E4 Yes L N 51 54 4 Reserved Space E4
469 RS-E5 Yes L A 55 55 1 Reserved Space E5
470 COMMREGEC Yes L N 56 56 1 Commercial Region Code, 2002 Economic Census
471 RS-E6 Yes L A 57 73 17 Reserved Space E6
472
473  
474  
475  
476 =head1 AUTHOR
477  
478 Michael G Schwern <schwern@pobox.com>
479  
480 =head1 SEE ALSO
481  
482 L<Geo::TigerLine>, L<mk_parsers>
483  
484 =cut
485  
486  
487 return 'Honey flash!';