TigerLine/Record/B.pm untested

filter: Statementstmt 0.0% 0 / 50 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 54 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::B;
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 'statecq' => {
16 'len' => 2,
17 'beg' => 26,
18 'bv' => 'No',
19 'fieldnum' => 6,
20 'type' => 'N',
21 'description' => 'FIPS State Code, 2000 CQR',
22 'end' => 27,
23 'fmt' => 'L',
24 'field' => 'statecq'
25 },
26 'file' => {
27 'len' => 5,
28 'beg' => 6,
29 'bv' => 'No',
30 'fieldnum' => 3,
31 'type' => 'N',
32 'description' => 'File Code',
33 'end' => 10,
34 'fmt' => 'L',
35 'field' => 'file'
36 },
37 'anrccq' => {
38 'len' => 5,
39 'beg' => 60,
40 'bv' => 'Yes',
41 'fieldnum' => 15,
42 'type' => 'N',
43 'description' => 'FIPS 55 Code (ANRC), 2000 CQR',
44 'end' => 64,
45 'fmt' => 'L',
46 'field' => 'anrccq'
47 },
48 'rs_b1' => {
49 'len' => 8,
50 'beg' => 91,
51 'bv' => 'Yes',
52 'fieldnum' => 22,
53 'type' => 'A',
54 'description' => 'Reserved Space B1',
55 'end' => 98,
56 'fmt' => 'L',
57 'field' => 'rs_b1'
58 },
59 'cenid' => {
60 'len' => 5,
61 'beg' => 11,
62 'bv' => 'No',
63 'fieldnum' => 4,
64 'type' => 'A',
65 'description' => 'Census File Identification Code',
66 'end' => 15,
67 'fmt' => 'L',
68 'field' => 'cenid'
69 },
70 'tractcq' => {
71 'len' => 6,
72 'beg' => 31,
73 'bv' => 'No',
74 'fieldnum' => 8,
75 'type' => 'N',
76 'description' => 'Census Tract, 2000 CQR',
77 'end' => 36,
78 'fmt' => 'L',
79 'field' => 'tractcq'
80 },
81 'rt' => {
82 'len' => 1,
83 'beg' => 1,
84 'bv' => 'No',
85 'fieldnum' => 1,
86 'type' => 'A',
87 'description' => 'Record Type',
88 'end' => 1,
89 'fmt' => 'L',
90 'field' => 'rt'
91 },
92 'countycq' => {
93 'len' => 3,
94 'beg' => 28,
95 'bv' => 'No',
96 'fieldnum' => 7,
97 'type' => 'N',
98 'description' => 'FIPS County Code, 2000 CQR',
99 'end' => 30,
100 'fmt' => 'L',
101 'field' => 'countycq'
102 },
103 'submcdcq' => {
104 'len' => 5,
105 'beg' => 75,
106 'bv' => 'Yes',
107 'fieldnum' => 18,
108 'type' => 'N',
109 'description' => 'FIPS 55 Code (Subbarrio), 2000 CQR',
110 'end' => 79,
111 'fmt' => 'L',
112 'field' => 'submcdcq'
113 },
114 'version' => {
115 'len' => 4,
116 'beg' => 2,
117 'bv' => 'No',
118 'fieldnum' => 2,
119 'type' => 'N',
120 'description' => 'Version Number',
121 'end' => 5,
122 'fmt' => 'L',
123 'field' => 'version'
124 },
125 'aihhtlicq' => {
126 'len' => 1,
127 'beg' => 51,
128 'bv' => 'Yes',
129 'fieldnum' => 12,
130 'type' => 'A',
131 'description' => 'American Indian/Hawaiian Home Land Trust Land Indicator, 2000 CQR',
132 'end' => 51,
133 'fmt' => 'L',
134 'field' => 'aihhtlicq'
135 },
136 'polyid' => {
137 'len' => 10,
138 'beg' => 16,
139 'bv' => 'No',
140 'fieldnum' => 5,
141 'type' => 'N',
142 'description' => 'Polygon Identification Code',
143 'end' => 25,
144 'fmt' => 'R',
145 'field' => 'polyid'
146 },
147 'aianhhfpcq' => {
148 'len' => 5,
149 'beg' => 42,
150 'bv' => 'Yes',
151 'fieldnum' => 10,
152 'type' => 'N',
153 'description' => 'FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 CQR',
154 'end' => 46,
155 'fmt' => 'L',
156 'field' => 'aianhhfpcq'
157 },
158 'rs_b2' => {
159 'len' => 5,
160 'beg' => 85,
161 'bv' => 'Yes',
162 'fieldnum' => 20,
163 'type' => 'N',
164 'description' => 'Reserved Space B2',
165 'end' => 89,
166 'fmt' => 'L',
167 'field' => 'rs_b2'
168 },
169 'aitscq' => {
170 'len' => 5,
171 'beg' => 55,
172 'bv' => 'Yes',
173 'fieldnum' => 14,
174 'type' => 'N',
175 'description' => 'FIPS 55 Code (American Indian Tribal Subdivision), 2000 CQR',
176 'end' => 59,
177 'fmt' => 'L',
178 'field' => 'aitscq'
179 },
180 'cousubcq' => {
181 'len' => 5,
182 'beg' => 70,
183 'bv' => 'No',
184 'fieldnum' => 17,
185 'type' => 'N',
186 'description' => 'FIPS 55 Code (County Subdivision), 2000 CQR',
187 'end' => 74,
188 'fmt' => 'L',
189 'field' => 'cousubcq'
190 },
191 'aianhhcq' => {
192 'len' => 4,
193 'beg' => 47,
194 'bv' => 'Yes',
195 'fieldnum' => 11,
196 'type' => 'N',
197 'description' => 'Census Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 CQR',
198 'end' => 50,
199 'fmt' => 'L',
200 'field' => 'aianhhcq'
201 },
202 'placecq' => {
203 'len' => 5,
204 'beg' => 80,
205 'bv' => 'Yes',
206 'fieldnum' => 19,
207 'type' => 'N',
208 'description' => 'FIPS 55 Code (Incorporated Place), 2000 CQR',
209 'end' => 84,
210 'fmt' => 'L',
211 'field' => 'placecq'
212 },
213 'blockcq' => {
214 'len' => 5,
215 'beg' => 37,
216 'bv' => 'No',
217 'fieldnum' => 9,
218 'type' => 'A',
219 'description' => 'Census Block Number, 2000 CQR',
220 'end' => 41,
221 'fmt' => 'L',
222 'field' => 'blockcq'
223 },
224 'aitscecq' => {
225 'len' => 3,
226 'beg' => 52,
227 'bv' => 'Yes',
228 'fieldnum' => 13,
229 'type' => 'N',
230 'description' => 'Census Code (American Indian Tribal Subdivision), 2000 CQR',
231 'end' => 54,
232 'fmt' => 'L',
233 'field' => 'aitscecq'
234 },
235 'concitcq' => {
236 'len' => 5,
237 'beg' => 65,
238 'bv' => 'Yes',
239 'fieldnum' => 16,
240 'type' => 'N',
241 'description' => 'FIPS 55 Code (Consolidated City), 2000 CQR',
242 'end' => 69,
243 'fmt' => 'L',
244 'field' => 'concitcq'
245 },
246 'rs_b3' => {
247 'len' => 1,
248 'beg' => 90,
249 'bv' => 'Yes',
250 'fieldnum' => 21,
251 'type' => 'A',
252 'description' => 'Reserved Space B3',
253 'end' => 90,
254 'fmt' => 'L',
255 'field' => 'rs_b3'
256 }
257 );
258  
259  
260 my @Data_Fields = (
261 'rt',
262 'version',
263 'file',
264 'cenid',
265 'polyid',
266 'statecq',
267 'countycq',
268 'tractcq',
269 'blockcq',
270 'aianhhfpcq',
271 'aianhhcq',
272 'aihhtlicq',
273 'aitscecq',
274 'aitscq',
275 'anrccq',
276 'concitcq',
277 'cousubcq',
278 'submcdcq',
279 'placecq',
280 'rs_b2',
281 'rs_b3',
282 'rs_b1'
283 );
284  
285  
286 assert(keys %Data_Dict == @Data_Fields);
287  
288 # Turn the data dictionary into class data
289 __PACKAGE__->mk_classdata('Fields');
290 __PACKAGE__->mk_classdata('Dict');
291 __PACKAGE__->mk_classdata('Pack_Tmpl');
292  
293 __PACKAGE__->Dict(\%Data_Dict);
294 __PACKAGE__->Fields(\@Data_Fields);
295  
296 # Generate a pack template for parsing and turn it into class data.
297 my $pack_tmpl = join ' ', map { "A$_" } map { $_->{len} }
298 @Data_Dict{@Data_Fields};
299 __PACKAGE__->Pack_Tmpl($pack_tmpl);
300  
301 # Generate accessors for each data field
302 foreach my $def (@Data_Dict{@Data_Fields}) {
303 __PACKAGE__->mk_accessor($def);
304 }
305  
306  
307 =pod
308  
309 =head1 NAME
310  
311 Geo::TigerLine::Record::B - TIGER/Line 2006 Polygon Geographic Entity Codes: Corrections
312  
313 =head1 SYNOPSIS
314  
315 use Geo::TigerLine::Record::B;
316  
317 @records = Geo::TigerLine::Record::B->parse_file($fh);
318 @records = Geo::TigerLine::Record::B->parse_file($fh, \&callback);
319  
320 $record = Geo::TigerLine::Record::B->new(\%fields);
321  
322 $record->rt();
323 $record->version();
324 $record->file();
325 $record->cenid();
326 $record->polyid();
327 $record->statecq();
328 $record->countycq();
329 $record->tractcq();
330 $record->blockcq();
331 $record->aianhhfpcq();
332 $record->aianhhcq();
333 $record->aihhtlicq();
334 $record->aitscecq();
335 $record->aitscq();
336 $record->anrccq();
337 $record->concitcq();
338 $record->cousubcq();
339 $record->submcdcq();
340 $record->placecq();
341 $record->rs_b2();
342 $record->rs_b3();
343 $record->rs_b1();
344  
345  
346 =head1 DESCRIPTION
347  
348 This is a class representing record type B of the TIGER/Line 2006
349 census geographic database. Each object is one record. It also
350 contains methods to parse TIGER/Line record type B files and turn them
351 into objects.
352  
353 This is intended as an intermediate format between pulling the raw
354 data out of the simplistic TIGER/Line data files into something more
355 sophisticated (a process you should only have to do once). As such,
356 it's not very fast, but its careful, easy to use and performs some
357 verifications on the data being read.
358  
359 As this class is autogenerated by mk_parsers, think before you modify this
360 file. It's OO, so consider sub-classing instead.
361  
362  
363 =head2 Accessors
364  
365 These are simple get/set accessors for each field of a record
366 generated from the TIGER/Line 2006 data dictionary. They perform some
367 data validation.
368  
369 =over 4
370  
371 =item B<rt>
372  
373 $data = $record->rt();
374 $record->rt($data);
375  
376 Record Type.
377  
378 Expects alphanumeric data of no more than 1 characters. $data cannot be blank
379 and should be left justified.
380  
381  
382 =item B<version>
383  
384 $data = $record->version();
385 $record->version($data);
386  
387 Version Number.
388  
389 Expects numeric data of no more than 4 characters. $data cannot be blank
390 and should be left justified.
391  
392  
393 =item B<file>
394  
395 $data = $record->file();
396 $record->file($data);
397  
398 File Code.
399  
400 Expects numeric data of no more than 5 characters. $data cannot be blank
401 and should be left justified.
402  
403  
404 =item B<cenid>
405  
406 $data = $record->cenid();
407 $record->cenid($data);
408  
409 Census File Identification Code.
410  
411 Expects alphanumeric data of no more than 5 characters. $data cannot be blank
412 and should be left justified.
413  
414  
415 =item B<polyid>
416  
417 $data = $record->polyid();
418 $record->polyid($data);
419  
420 Polygon Identification Code.
421  
422 Expects numeric data of no more than 10 characters. $data cannot be blank
423 and should be right justified.
424  
425  
426 =item B<statecq>
427  
428 $data = $record->statecq();
429 $record->statecq($data);
430  
431 FIPS State Code, 2000 CQR.
432  
433 Expects numeric data of no more than 2 characters. $data cannot be blank
434 and should be left justified.
435  
436  
437 =item B<countycq>
438  
439 $data = $record->countycq();
440 $record->countycq($data);
441  
442 FIPS County Code, 2000 CQR.
443  
444 Expects numeric data of no more than 3 characters. $data cannot be blank
445 and should be left justified.
446  
447  
448 =item B<tractcq>
449  
450 $data = $record->tractcq();
451 $record->tractcq($data);
452  
453 Census Tract, 2000 CQR.
454  
455 Expects numeric data of no more than 6 characters. $data cannot be blank
456 and should be left justified.
457  
458  
459 =item B<blockcq>
460  
461 $data = $record->blockcq();
462 $record->blockcq($data);
463  
464 Census Block Number, 2000 CQR.
465  
466 Expects alphanumeric data of no more than 5 characters. $data cannot be blank
467 and should be left justified.
468  
469  
470 =item B<aianhhfpcq>
471  
472 $data = $record->aianhhfpcq();
473 $record->aianhhfpcq($data);
474  
475 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 CQR.
476  
477 Expects numeric data of no more than 5 characters. $data can be blank
478 and should be left justified.
479  
480  
481 =item B<aianhhcq>
482  
483 $data = $record->aianhhcq();
484 $record->aianhhcq($data);
485  
486 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 CQR.
487  
488 Expects numeric data of no more than 4 characters. $data can be blank
489 and should be left justified.
490  
491  
492 =item B<aihhtlicq>
493  
494 $data = $record->aihhtlicq();
495 $record->aihhtlicq($data);
496  
497 American Indian/Hawaiian Home Land Trust Land Indicator, 2000 CQR.
498  
499 Expects alphanumeric data of no more than 1 characters. $data can be blank
500 and should be left justified.
501  
502  
503 =item B<aitscecq>
504  
505 $data = $record->aitscecq();
506 $record->aitscecq($data);
507  
508 Census Code (American Indian Tribal Subdivision), 2000 CQR.
509  
510 Expects numeric data of no more than 3 characters. $data can be blank
511 and should be left justified.
512  
513  
514 =item B<aitscq>
515  
516 $data = $record->aitscq();
517 $record->aitscq($data);
518  
519 FIPS 55 Code (American Indian Tribal Subdivision), 2000 CQR.
520  
521 Expects numeric data of no more than 5 characters. $data can be blank
522 and should be left justified.
523  
524  
525 =item B<anrccq>
526  
527 $data = $record->anrccq();
528 $record->anrccq($data);
529  
530 FIPS 55 Code (ANRC), 2000 CQR.
531  
532 Expects numeric data of no more than 5 characters. $data can be blank
533 and should be left justified.
534  
535  
536 =item B<concitcq>
537  
538 $data = $record->concitcq();
539 $record->concitcq($data);
540  
541 FIPS 55 Code (Consolidated City), 2000 CQR.
542  
543 Expects numeric data of no more than 5 characters. $data can be blank
544 and should be left justified.
545  
546  
547 =item B<cousubcq>
548  
549 $data = $record->cousubcq();
550 $record->cousubcq($data);
551  
552 FIPS 55 Code (County Subdivision), 2000 CQR.
553  
554 Expects numeric data of no more than 5 characters. $data cannot be blank
555 and should be left justified.
556  
557  
558 =item B<submcdcq>
559  
560 $data = $record->submcdcq();
561 $record->submcdcq($data);
562  
563 FIPS 55 Code (Subbarrio), 2000 CQR.
564  
565 Expects numeric data of no more than 5 characters. $data can be blank
566 and should be left justified.
567  
568  
569 =item B<placecq>
570  
571 $data = $record->placecq();
572 $record->placecq($data);
573  
574 FIPS 55 Code (Incorporated Place), 2000 CQR.
575  
576 Expects numeric data of no more than 5 characters. $data can be blank
577 and should be left justified.
578  
579  
580 =item B<rs_b2>
581  
582 $data = $record->rs_b2();
583 $record->rs_b2($data);
584  
585 Reserved Space B2.
586  
587 Expects numeric data of no more than 5 characters. $data can be blank
588 and should be left justified.
589  
590  
591 =item B<rs_b3>
592  
593 $data = $record->rs_b3();
594 $record->rs_b3($data);
595  
596 Reserved Space B3.
597  
598 Expects alphanumeric data of no more than 1 characters. $data can be blank
599 and should be left justified.
600  
601  
602 =item B<rs_b1>
603  
604 $data = $record->rs_b1();
605 $record->rs_b1($data);
606  
607 Reserved Space B1.
608  
609 Expects alphanumeric data of no more than 8 characters. $data can be blank
610 and should be left justified.
611  
612  
613  
614 =back
615  
616  
617 =head2 Data dictionary
618  
619 This is the original TIGER/Line 2006 data dictionary from which this
620 class was generated.
621  
622 Record Type B - Polygon Geographic Entity Codes: Corrections
623
624 Field BV Fmt Type Beg End Len Description
625 RT No L A 1 1 1 Record Type
626 VERSION No L N 2 5 4 Version Number
627 FILE No L N 6 10 5 File Code
628 CENID No L A 11 15 5 Census File Identification Code
629 POLYID No R N 16 25 10 Polygon Identification Code
630 STATECQ No L N 26 27 2 FIPS State Code, 2000 CQR
631 COUNTYCQ No L N 28 30 3 FIPS County Code, 2000 CQR
632 TRACTCQ No L N 31 36 6 Census Tract, 2000 CQR
633 BLOCKCQ No L A 37 41 5 Census Block Number, 2000 CQR
634 AIANHHFPCQ Yes L N 42 46 5 FIPS 55 Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 CQR
635 AIANHHCQ Yes L N 47 50 4 Census Code (American Indian/Alaska Native Area/Hawaiian Home Land), 2000 CQR
636 AIHHTLICQ Yes L A 51 51 1 American Indian/Hawaiian Home Land Trust Land Indicator, 2000 CQR
637 AITSCECQ Yes L N 52 54 3 Census Code (American Indian Tribal Subdivision), 2000 CQR
638 AITSCQ Yes L N 55 59 5 FIPS 55 Code (American Indian Tribal Subdivision), 2000 CQR
639 ANRCCQ Yes L N 60 64 5 FIPS 55 Code (ANRC), 2000 CQR
640 CONCITCQ Yes L N 65 69 5 FIPS 55 Code (Consolidated City), 2000 CQR
641 COUSUBCQ No L N 70 74 5 FIPS 55 Code (County Subdivision), 2000 CQR
642 SUBMCDCQ Yes L N 75 79 5 FIPS 55 Code (Subbarrio), 2000 CQR
643 PLACECQ Yes L N 80 84 5 FIPS 55 Code (Incorporated Place), 2000 CQR
644 RS-B2 Yes L N 85 89 5 Reserved Space B2
645 RS-B3 Yes L A 90 90 1 Reserved Space B3
646 RS-B1 Yes L A 91 98 8 Reserved Space B1
647  
648  
649  
650 =head1 AUTHOR
651  
652 Michael G Schwern <schwern@pobox.com>
653  
654 =head1 SEE ALSO
655  
656 L<Geo::TigerLine>, L<mk_parsers>
657  
658 =cut
659  
660  
661 return 'Honey flash!';