TigerLine/Record/C.pm untested

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