TigerLine/Record/5.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 40 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::5;
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 'version' => {
16 'len' => 4,
17 'beg' => 2,
18 'bv' => 'No',
19 'fieldnum' => 2,
20 'type' => 'N',
21 'description' => 'Version Number',
22 'end' => 5,
23 'fmt' => 'L',
24 'field' => 'version'
25 },
26 'fetype' => {
27 'len' => 4,
28 'beg' => 51,
29 'bv' => 'Yes',
30 'fieldnum' => 7,
31 'type' => 'A',
32 'description' => 'Feature Type',
33 'end' => 54,
34 'fmt' => 'L',
35 'field' => 'fetype'
36 },
37 'file' => {
38 'len' => 5,
39 'beg' => 6,
40 'bv' => 'No',
41 'fieldnum' => 3,
42 'type' => 'N',
43 'description' => 'File Code',
44 'end' => 10,
45 'fmt' => 'L',
46 'field' => 'file'
47 },
48 'fename' => {
49 'len' => 30,
50 'beg' => 21,
51 'bv' => 'Yes',
52 'fieldnum' => 6,
53 'type' => 'A',
54 'description' => 'Feature Name',
55 'end' => 50,
56 'fmt' => 'L',
57 'field' => 'fename'
58 },
59 'feat' => {
60 'len' => 8,
61 'beg' => 11,
62 'bv' => 'No',
63 'fieldnum' => 4,
64 'type' => 'N',
65 'description' => 'Line Name Identification Number',
66 'end' => 18,
67 'fmt' => 'R',
68 'field' => 'feat'
69 },
70 'fedirs' => {
71 'len' => 2,
72 'beg' => 55,
73 'bv' => 'Yes',
74 'fieldnum' => 8,
75 'type' => 'A',
76 'description' => 'Feature Direction, Suffix',
77 'end' => 56,
78 'fmt' => 'L',
79 'field' => 'fedirs'
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 'fedirp' => {
93 'len' => 2,
94 'beg' => 19,
95 'bv' => 'Yes',
96 'fieldnum' => 5,
97 'type' => 'A',
98 'description' => 'Feature Direction, Prefix',
99 'end' => 20,
100 'fmt' => 'L',
101 'field' => 'fedirp'
102 }
103 );
104  
105  
106 my @Data_Fields = (
107 'rt',
108 'version',
109 'file',
110 'feat',
111 'fedirp',
112 'fename',
113 'fetype',
114 'fedirs'
115 );
116  
117  
118 assert(keys %Data_Dict == @Data_Fields);
119  
120 # Turn the data dictionary into class data
121 __PACKAGE__->mk_classdata('Fields');
122 __PACKAGE__->mk_classdata('Dict');
123 __PACKAGE__->mk_classdata('Pack_Tmpl');
124  
125 __PACKAGE__->Dict(\%Data_Dict);
126 __PACKAGE__->Fields(\@Data_Fields);
127  
128 # Generate a pack template for parsing and turn it into class data.
129 my $pack_tmpl = join ' ', map { "A$_" } map { $_->{len} }
130 @Data_Dict{@Data_Fields};
131 __PACKAGE__->Pack_Tmpl($pack_tmpl);
132  
133 # Generate accessors for each data field
134 foreach my $def (@Data_Dict{@Data_Fields}) {
135 __PACKAGE__->mk_accessor($def);
136 }
137  
138  
139 =pod
140  
141 =head1 NAME
142  
143 Geo::TigerLine::Record::5 - TIGER/Line 2006 Complete Chain Feature Identifiers
144  
145 =head1 SYNOPSIS
146  
147 use Geo::TigerLine::Record::5;
148  
149 @records = Geo::TigerLine::Record::5->parse_file($fh);
150 @records = Geo::TigerLine::Record::5->parse_file($fh, \&callback);
151  
152 $record = Geo::TigerLine::Record::5->new(\%fields);
153  
154 $record->rt();
155 $record->version();
156 $record->file();
157 $record->feat();
158 $record->fedirp();
159 $record->fename();
160 $record->fetype();
161 $record->fedirs();
162  
163  
164 =head1 DESCRIPTION
165  
166 This is a class representing record type 5 of the TIGER/Line 2006
167 census geographic database. Each object is one record. It also
168 contains methods to parse TIGER/Line record type 5 files and turn them
169 into objects.
170  
171 This is intended as an intermediate format between pulling the raw
172 data out of the simplistic TIGER/Line data files into something more
173 sophisticated (a process you should only have to do once). As such,
174 it's not very fast, but its careful, easy to use and performs some
175 verifications on the data being read.
176  
177 As this class is autogenerated by mk_parsers, think before you modify this
178 file. It's OO, so consider sub-classing instead.
179  
180  
181 =head2 Accessors
182  
183 These are simple get/set accessors for each field of a record
184 generated from the TIGER/Line 2006 data dictionary. They perform some
185 data validation.
186  
187 =over 4
188  
189 =item B<rt>
190  
191 $data = $record->rt();
192 $record->rt($data);
193  
194 Record Type.
195  
196 Expects alphanumeric data of no more than 1 characters. $data cannot be blank
197 and should be left justified.
198  
199  
200 =item B<version>
201  
202 $data = $record->version();
203 $record->version($data);
204  
205 Version Number.
206  
207 Expects numeric data of no more than 4 characters. $data cannot be blank
208 and should be left justified.
209  
210  
211 =item B<file>
212  
213 $data = $record->file();
214 $record->file($data);
215  
216 File Code.
217  
218 Expects numeric data of no more than 5 characters. $data cannot be blank
219 and should be left justified.
220  
221  
222 =item B<feat>
223  
224 $data = $record->feat();
225 $record->feat($data);
226  
227 Line Name Identification Number.
228  
229 Expects numeric data of no more than 8 characters. $data cannot be blank
230 and should be right justified.
231  
232  
233 =item B<fedirp>
234  
235 $data = $record->fedirp();
236 $record->fedirp($data);
237  
238 Feature Direction, Prefix.
239  
240 Expects alphanumeric data of no more than 2 characters. $data can be blank
241 and should be left justified.
242  
243  
244 =item B<fename>
245  
246 $data = $record->fename();
247 $record->fename($data);
248  
249 Feature Name.
250  
251 Expects alphanumeric data of no more than 30 characters. $data can be blank
252 and should be left justified.
253  
254  
255 =item B<fetype>
256  
257 $data = $record->fetype();
258 $record->fetype($data);
259  
260 Feature Type.
261  
262 Expects alphanumeric data of no more than 4 characters. $data can be blank
263 and should be left justified.
264  
265  
266 =item B<fedirs>
267  
268 $data = $record->fedirs();
269 $record->fedirs($data);
270  
271 Feature Direction, Suffix.
272  
273 Expects alphanumeric data of no more than 2 characters. $data can be blank
274 and should be left justified.
275  
276  
277  
278 =back
279  
280  
281 =head2 Data dictionary
282  
283 This is the original TIGER/Line 2006 data dictionary from which this
284 class was generated.
285  
286 Record Type 5 - Complete Chain Feature Identifiers
287
288 Field BV Fmt Type Beg End Len Description
289 RT No L A 1 1 1 Record Type
290 VERSION No L N 2 5 4 Version Number
291 FILE No L N 6 10 5 File Code
292 FEAT No R N 11 18 8 Line Name Identification Number
293 FEDIRP Yes L A 19 20 2 Feature Direction, Prefix
294 FENAME Yes L A 21 50 30 Feature Name
295 FETYPE Yes L A 51 54 4 Feature Type
296 FEDIRS Yes L A 55 56 2 Feature Direction, Suffix
297  
298  
299  
300 =head1 AUTHOR
301  
302 Michael G Schwern <schwern@pobox.com>
303  
304 =head1 SEE ALSO
305  
306 L<Geo::TigerLine>, L<mk_parsers>
307  
308 =cut
309  
310  
311 return 'Honey flash!';