TigerLine/Record/7.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::7;
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' => 21,
18 'bv' => 'Yes',
19 'fieldnum' => 5,
20 'type' => 'A',
21 'description' => 'Source or First Source Code to Update',
22 'end' => 21,
23 'fmt' => 'L',
24 'field' => 'source'
25 },
26 'lalat' => {
27 'len' => 9,
28 'beg' => 65,
29 'bv' => 'Yes',
30 'fieldnum' => 9,
31 'type' => 'N',
32 'description' => 'Latitude',
33 'end' => 73,
34 'fmt' => 'R',
35 'field' => 'lalat'
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 'lalong' => {
49 'len' => 10,
50 'beg' => 55,
51 'bv' => 'Yes',
52 'fieldnum' => 8,
53 'type' => 'N',
54 'description' => 'Longitude',
55 'end' => 64,
56 'fmt' => 'R',
57 'field' => 'lalong'
58 },
59 'file' => {
60 'len' => 5,
61 'beg' => 6,
62 'bv' => 'No',
63 'fieldnum' => 3,
64 'type' => 'N',
65 'description' => 'File Code',
66 'end' => 10,
67 'fmt' => 'L',
68 'field' => 'file'
69 },
70 'land' => {
71 'len' => 10,
72 'beg' => 11,
73 'bv' => 'No',
74 'fieldnum' => 4,
75 'type' => 'N',
76 'description' => 'Landmark Identification Number',
77 'end' => 20,
78 'fmt' => 'R',
79 'field' => 'land'
80 },
81 'laname' => {
82 'len' => 30,
83 'beg' => 25,
84 'bv' => 'Yes',
85 'fieldnum' => 7,
86 'type' => 'A',
87 'description' => 'Landmark Name',
88 'end' => 54,
89 'fmt' => 'L',
90 'field' => 'laname'
91 },
92 'filler' => {
93 'len' => 1,
94 'beg' => 74,
95 'bv' => 'Yes',
96 'fieldnum' => 10,
97 'type' => 'A',
98 'description' => 'Filler (to make even character count)',
99 'end' => 74,
100 'fmt' => 'L',
101 'field' => 'filler'
102 },
103 'rt' => {
104 'len' => 1,
105 'beg' => 1,
106 'bv' => 'No',
107 'fieldnum' => 1,
108 'type' => 'A',
109 'description' => 'Record Type',
110 'end' => 1,
111 'fmt' => 'L',
112 'field' => 'rt'
113 },
114 'cfcc' => {
115 'len' => 3,
116 'beg' => 22,
117 'bv' => 'No',
118 'fieldnum' => 6,
119 'type' => 'A',
120 'description' => 'Census Feature Class Code',
121 'end' => 24,
122 'fmt' => 'L',
123 'field' => 'cfcc'
124 }
125 );
126  
127  
128 my @Data_Fields = (
129 'rt',
130 'version',
131 'file',
132 'land',
133 'source',
134 'cfcc',
135 'laname',
136 'lalong',
137 'lalat',
138 'filler'
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::7 - TIGER/Line 2006 Landmark Features
168  
169 =head1 SYNOPSIS
170  
171 use Geo::TigerLine::Record::7;
172  
173 @records = Geo::TigerLine::Record::7->parse_file($fh);
174 @records = Geo::TigerLine::Record::7->parse_file($fh, \&callback);
175  
176 $record = Geo::TigerLine::Record::7->new(\%fields);
177  
178 $record->rt();
179 $record->version();
180 $record->file();
181 $record->land();
182 $record->source();
183 $record->cfcc();
184 $record->laname();
185 $record->lalong();
186 $record->lalat();
187 $record->filler();
188  
189  
190 =head1 DESCRIPTION
191  
192 This is a class representing record type 7 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 7 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<land>
249  
250 $data = $record->land();
251 $record->land($data);
252  
253 Landmark Identification 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<source>
260  
261 $data = $record->source();
262 $record->source($data);
263  
264 Source or First 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<cfcc>
271  
272 $data = $record->cfcc();
273 $record->cfcc($data);
274  
275 Census Feature Class Code.
276  
277 Expects alphanumeric data of no more than 3 characters. $data cannot be blank
278 and should be left justified.
279  
280  
281 =item B<laname>
282  
283 $data = $record->laname();
284 $record->laname($data);
285  
286 Landmark Name.
287  
288 Expects alphanumeric data of no more than 30 characters. $data can be blank
289 and should be left justified.
290  
291  
292 =item B<lalong>
293  
294 $data = $record->lalong();
295 $record->lalong($data);
296  
297 Longitude.
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<lalat>
304  
305 $data = $record->lalat();
306 $record->lalat($data);
307  
308 Latitude.
309  
310 Expects numeric data of no more than 9 characters. $data can be blank
311 and should be right justified.
312  
313  
314 =item B<filler>
315  
316 $data = $record->filler();
317 $record->filler($data);
318  
319 Filler (to make even character count).
320  
321 Expects alphanumeric data of no more than 1 characters. $data can be blank
322 and should be left 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 7 - Landmark Features
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 LAND No R N 11 20 10 Landmark Identification Number
341 SOURCE Yes L A 21 21 1 Source or First Source Code to Update
342 CFCC No L A 22 24 3 Census Feature Class Code
343 LANAME Yes L A 25 54 30 Landmark Name
344 LALONG Yes R N 55 64 10 Longitude
345 LALAT Yes R N 65 73 9 Latitude
346 FILLER Yes L A 74 74 1 Filler (to make even character count)
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!';