TigerLine/Record/H.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 42 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::H;
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 'source' => {
16 'len' => 1,
17 'beg' => 22,
18 'bv' => 'Yes',
19 'fieldnum' => 6,
20 'type' => 'A',
21 'description' => 'Source or First Source Code to Update',
22 'end' => 22,
23 'fmt' => 'L',
24 'field' => 'source'
25 },
26 'tlidto1' => {
27 'len' => 10,
28 'beg' => 43,
29 'bv' => 'Yes',
30 'fieldnum' => 9,
31 'type' => 'N',
32 'description' => 'TIGER/Line ID, Became Number 1',
33 'end' => 52,
34 'fmt' => 'R',
35 'field' => 'tlidto1'
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 '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 'tlidfr2' => {
60 'len' => 10,
61 'beg' => 33,
62 'bv' => 'Yes',
63 'fieldnum' => 8,
64 'type' => 'N',
65 'description' => 'TIGER/Line ID, Created From Number 2',
66 'end' => 42,
67 'fmt' => 'R',
68 'field' => 'tlidfr2'
69 },
70 'hist' => {
71 'len' => 1,
72 'beg' => 21,
73 'bv' => 'Yes',
74 'fieldnum' => 5,
75 'type' => 'A',
76 'description' => 'History or Last Source Code to Update',
77 'end' => 21,
78 'fmt' => 'L',
79 'field' => 'hist'
80 },
81 'tlidto2' => {
82 'len' => 10,
83 'beg' => 53,
84 'bv' => 'Yes',
85 'fieldnum' => 10,
86 'type' => 'N',
87 'description' => 'TIGER/Line ID, Became Number 2',
88 'end' => 62,
89 'fmt' => 'R',
90 'field' => 'tlidto2'
91 },
92 'tlid' => {
93 'len' => 10,
94 'beg' => 11,
95 'bv' => 'No',
96 'fieldnum' => 4,
97 'type' => 'N',
98 'description' => 'TIGER/Line ID, Permanent 1-Cell Number',
99 'end' => 20,
100 'fmt' => 'R',
101 'field' => 'tlid'
102 },
103 'tlidfr1' => {
104 'len' => 10,
105 'beg' => 23,
106 'bv' => 'Yes',
107 'fieldnum' => 7,
108 'type' => 'N',
109 'description' => 'TIGER/Line ID, Created From Number 1',
110 'end' => 32,
111 'fmt' => 'R',
112 'field' => 'tlidfr1'
113 },
114 'rt' => {
115 'len' => 1,
116 'beg' => 1,
117 'bv' => 'No',
118 'fieldnum' => 1,
119 'type' => 'A',
120 'description' => 'Record Type',
121 'end' => 1,
122 'fmt' => 'L',
123 'field' => 'rt'
124 }
125 );
126  
127  
128 my @Data_Fields = (
129 'rt',
130 'version',
131 'file',
132 'tlid',
133 'hist',
134 'source',
135 'tlidfr1',
136 'tlidfr2',
137 'tlidto1',
138 'tlidto2'
139 );
140  
141  
142 assert(keys %Data_Dict == @Data_Fields);
143  
144 # Turn the data dictionary into class data
145 __PACKAGE__->mk_classdata('Fields');
146 __PACKAGE__->mk_classdata('Dict');
147 __PACKAGE__->mk_classdata('Pack_Tmpl');
148  
149 __PACKAGE__->Dict(\%Data_Dict);
150 __PACKAGE__->Fields(\@Data_Fields);
151  
152 # Generate a pack template for parsing and turn it into class data.
153 my $pack_tmpl = join ' ', map { "A$_" } map { $_->{len} }
154 @Data_Dict{@Data_Fields};
155 __PACKAGE__->Pack_Tmpl($pack_tmpl);
156  
157 # Generate accessors for each data field
158 foreach my $def (@Data_Dict{@Data_Fields}) {
159 __PACKAGE__->mk_accessor($def);
160 }
161  
162  
163 =pod
164  
165 =head1 NAME
166  
167 Geo::TigerLine::Record::H - TIGER/Line 2006 TIGER/Line ID History
168  
169 =head1 SYNOPSIS
170  
171 use Geo::TigerLine::Record::H;
172  
173 @records = Geo::TigerLine::Record::H->parse_file($fh);
174 @records = Geo::TigerLine::Record::H->parse_file($fh, \&callback);
175  
176 $record = Geo::TigerLine::Record::H->new(\%fields);
177  
178 $record->rt();
179 $record->version();
180 $record->file();
181 $record->tlid();
182 $record->hist();
183 $record->source();
184 $record->tlidfr1();
185 $record->tlidfr2();
186 $record->tlidto1();
187 $record->tlidto2();
188  
189  
190 =head1 DESCRIPTION
191  
192 This is a class representing record type H of the TIGER/Line 2006
193 census geographic database. Each object is one record. It also
194 contains methods to parse TIGER/Line record type H files and turn them
195 into objects.
196  
197 This is intended as an intermediate format between pulling the raw
198 data out of the simplistic TIGER/Line data files into something more
199 sophisticated (a process you should only have to do once). As such,
200 it's not very fast, but its careful, easy to use and performs some
201 verifications on the data being read.
202  
203 As this class is autogenerated by mk_parsers, think before you modify this
204 file. It's OO, so consider sub-classing instead.
205  
206  
207 =head2 Accessors
208  
209 These are simple get/set accessors for each field of a record
210 generated from the TIGER/Line 2006 data dictionary. They perform some
211 data validation.
212  
213 =over 4
214  
215 =item B<rt>
216  
217 $data = $record->rt();
218 $record->rt($data);
219  
220 Record Type.
221  
222 Expects alphanumeric data of no more than 1 characters. $data cannot be blank
223 and should be left justified.
224  
225  
226 =item B<version>
227  
228 $data = $record->version();
229 $record->version($data);
230  
231 Version Number.
232  
233 Expects numeric data of no more than 4 characters. $data cannot be blank
234 and should be left justified.
235  
236  
237 =item B<file>
238  
239 $data = $record->file();
240 $record->file($data);
241  
242 File Code.
243  
244 Expects numeric data of no more than 5 characters. $data cannot be blank
245 and should be left justified.
246  
247  
248 =item B<tlid>
249  
250 $data = $record->tlid();
251 $record->tlid($data);
252  
253 TIGER/Line ID, Permanent 1-Cell Number.
254  
255 Expects numeric data of no more than 10 characters. $data cannot be blank
256 and should be right justified.
257  
258  
259 =item B<hist>
260  
261 $data = $record->hist();
262 $record->hist($data);
263  
264 History or Last Source Code to Update.
265  
266 Expects alphanumeric data of no more than 1 characters. $data can be blank
267 and should be left justified.
268  
269  
270 =item B<source>
271  
272 $data = $record->source();
273 $record->source($data);
274  
275 Source or First Source Code to Update.
276  
277 Expects alphanumeric data of no more than 1 characters. $data can be blank
278 and should be left justified.
279  
280  
281 =item B<tlidfr1>
282  
283 $data = $record->tlidfr1();
284 $record->tlidfr1($data);
285  
286 TIGER/Line ID, Created From Number 1.
287  
288 Expects numeric data of no more than 10 characters. $data can be blank
289 and should be right justified.
290  
291  
292 =item B<tlidfr2>
293  
294 $data = $record->tlidfr2();
295 $record->tlidfr2($data);
296  
297 TIGER/Line ID, Created From Number 2.
298  
299 Expects numeric data of no more than 10 characters. $data can be blank
300 and should be right justified.
301  
302  
303 =item B<tlidto1>
304  
305 $data = $record->tlidto1();
306 $record->tlidto1($data);
307  
308 TIGER/Line ID, Became Number 1.
309  
310 Expects numeric data of no more than 10 characters. $data can be blank
311 and should be right justified.
312  
313  
314 =item B<tlidto2>
315  
316 $data = $record->tlidto2();
317 $record->tlidto2($data);
318  
319 TIGER/Line ID, Became Number 2.
320  
321 Expects numeric data of no more than 10 characters. $data can be blank
322 and should be right justified.
323  
324  
325  
326 =back
327  
328  
329 =head2 Data dictionary
330  
331 This is the original TIGER/Line 2006 data dictionary from which this
332 class was generated.
333  
334 Record Type H - TIGER/Line ID History
335
336 Field BV Fmt Type Beg End Len Description
337 RT No L A 1 1 1 Record Type
338 VERSION No L N 2 5 4 Version Number
339 FILE No L N 6 10 5 File Code
340 TLID No R N 11 20 10 TIGER/Line ID, Permanent 1-Cell Number
341 HIST Yes L A 21 21 1 History or Last Source Code to Update
342 SOURCE Yes L A 22 22 1 Source or First Source Code to Update
343 TLIDFR1 Yes R N 23 32 10 TIGER/Line ID, Created From Number 1
344 TLIDFR2 Yes R N 33 42 10 TIGER/Line ID, Created From Number 2
345 TLIDTO1 Yes R N 43 52 10 TIGER/Line ID, Became Number 1
346 TLIDTO2 Yes R N 53 62 10 TIGER/Line ID, Became Number 2
347
348  
349  
350  
351 =head1 AUTHOR
352  
353 Michael G Schwern <schwern@pobox.com>
354  
355 =head1 SEE ALSO
356  
357 L<Geo::TigerLine>, L<mk_parsers>
358  
359 =cut
360  
361  
362 return 'Honey flash!';