line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package xDT::Record; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1007
|
use v5.10; |
|
1
|
|
|
|
|
2
|
|
4
|
1
|
|
|
1
|
|
143
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use namespace::autoclean; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use xDT::RecordType; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
xDT::Record - A xDT record |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 1.00 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Instances of this module correspond to records (lines) in a xDT file. |
25
|
|
|
|
|
|
|
They provide some methods to acces fields and record type metadata. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use xDT::Record; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $record = xDT::Record->new($line); |
30
|
|
|
|
|
|
|
say 'Value: '. $record->getValue(); |
31
|
|
|
|
|
|
|
say 'Length: '. $record->getLength(); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $recordType = $record->getRecordType(); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 length |
38
|
|
|
|
|
|
|
The length of this record. |
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has 'length' => ( |
42
|
|
|
|
|
|
|
is => 'ro', |
43
|
|
|
|
|
|
|
isa => 'Str', |
44
|
|
|
|
|
|
|
required => 1, |
45
|
|
|
|
|
|
|
reader => 'getLength', |
46
|
|
|
|
|
|
|
documentation => 'The length of this records value (there are 2 extra symbols at the end of the string).' |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 recordType |
50
|
|
|
|
|
|
|
This records record type. |
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
has 'recordType' => ( |
54
|
|
|
|
|
|
|
is => 'ro', |
55
|
|
|
|
|
|
|
isa => 'xDT::RecordType', |
56
|
|
|
|
|
|
|
required => 1, |
57
|
|
|
|
|
|
|
reader => 'getRecordType', |
58
|
|
|
|
|
|
|
handles => { |
59
|
|
|
|
|
|
|
getAccessor => 'getAccessor', |
60
|
|
|
|
|
|
|
getLabels => 'getLabels', |
61
|
|
|
|
|
|
|
getId => 'getId', |
62
|
|
|
|
|
|
|
getType => 'getType', |
63
|
|
|
|
|
|
|
getMaxLength => 'getLength', |
64
|
|
|
|
|
|
|
isObjectEnd => 'isObjectEnd', |
65
|
|
|
|
|
|
|
}, |
66
|
|
|
|
|
|
|
documentation => 'The record type of this record.' |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 value |
70
|
|
|
|
|
|
|
The value of this record. |
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has 'value' => ( |
74
|
|
|
|
|
|
|
is => 'ro', |
75
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
76
|
|
|
|
|
|
|
reader => 'getValue', |
77
|
|
|
|
|
|
|
documentation => 'The value of this record as string.' |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
around BUILDARGS => sub { |
81
|
|
|
|
|
|
|
my ($orig, $class, $line) = @_; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
return $class->$orig( |
84
|
|
|
|
|
|
|
length => substr($line, 0, 3), |
85
|
|
|
|
|
|
|
recordType => xDT::RecordType->new(substr($line, 3, 4)), |
86
|
|
|
|
|
|
|
value => substr($line, 7, -2), |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 getLength |
93
|
|
|
|
|
|
|
Returns the length of this record. |
94
|
|
|
|
|
|
|
=cut |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 getRecordType |
97
|
|
|
|
|
|
|
Returns the record type of this record. |
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 getAccessor |
101
|
|
|
|
|
|
|
Returns the accessor of the records record type. |
102
|
|
|
|
|
|
|
=cut |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 getLabels |
105
|
|
|
|
|
|
|
Returns the labels of the records record type. |
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 getId |
109
|
|
|
|
|
|
|
Returns the id of the records record type. |
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 getType |
113
|
|
|
|
|
|
|
Returns the type of the records record type. |
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 getMaxLength |
117
|
|
|
|
|
|
|
Returns the maximum length of the records record type. |
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 isObjectEnd |
121
|
|
|
|
|
|
|
Checks if the records record type is an end record. |
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 getValue |
125
|
|
|
|
|
|
|
Returns the value of this record. |
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 AUTHOR |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Christoph Beger, C<< >> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 BUGS |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
135
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
136
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 SUPPORT |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
perldoc xDT::Record |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
You can also look for information at: |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=over 4 |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * CPAN Ratings |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * Search CPAN |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
L |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=back |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Copyright 2017 Christoph Beger. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
This program is released under the following license: MIT |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
1; # End of xDT::Record |