TigerLine/Record/6.pm untested

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