line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use v5.10; |
3
|
4
|
|
|
4
|
|
55663
|
use Moose; |
|
4
|
|
|
|
|
20
|
|
4
|
4
|
|
|
4
|
|
490
|
|
|
4
|
|
|
|
|
415864
|
|
|
4
|
|
|
|
|
30
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
xDT::RecordType - The record type of a xDT record. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Version 1.06 |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '1.07'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Quick summary of what the module does. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Perhaps a little code snippet. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use xDT::RecordType; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $record_type = xDT::RecordType->new($id); |
27
|
|
|
|
|
|
|
# or |
28
|
|
|
|
|
|
|
my $record_type = xDT::RecordType->new($id, $config_file); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
say $record_type->get_labels()->{en}; |
31
|
|
|
|
|
|
|
say $record_type->get_accessor(); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 CONSTANTS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 LENGTH |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The maximum length of a record type identifier. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 END_RECORD_ID |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
ID of records at the end of an object. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use constant { |
46
|
|
|
|
|
|
|
LENGTH => 4, |
47
|
4
|
|
|
|
|
1830
|
END_RECORD_ID => 8003, |
48
|
|
|
|
|
|
|
}; |
49
|
4
|
|
|
4
|
|
24327
|
|
|
4
|
|
|
|
|
11
|
|
50
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 id |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Unique identifier of this record type. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has id => ( |
59
|
|
|
|
|
|
|
is => 'ro', |
60
|
|
|
|
|
|
|
isa => 'Str', |
61
|
|
|
|
|
|
|
required => 1, |
62
|
|
|
|
|
|
|
reader => 'get_id', |
63
|
|
|
|
|
|
|
trigger => \&_check_id, |
64
|
|
|
|
|
|
|
documentation => q{Unique identifier of this record type.}, |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 labels |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The human readable labels of this record type. Language is used as key value. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has labels => ( |
74
|
|
|
|
|
|
|
is => 'ro', |
75
|
|
|
|
|
|
|
isa => 'Maybe[HashRef[Str]]', |
76
|
|
|
|
|
|
|
reader => 'get_labels', |
77
|
|
|
|
|
|
|
documentation => q{The human readable labels of this record type. Language is used as key value.}, |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 accessor |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Short string for easy access to this record via xDT::Object. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
has accessor => ( |
87
|
|
|
|
|
|
|
is => 'ro', |
88
|
|
|
|
|
|
|
isa => 'Str', |
89
|
|
|
|
|
|
|
required => 1, |
90
|
|
|
|
|
|
|
lazy => 1, |
91
|
|
|
|
|
|
|
reader => 'get_accessor', |
92
|
|
|
|
|
|
|
default => sub { shift->get_id }, |
93
|
|
|
|
|
|
|
documentation => q{Short string for easy access to this record via xDT::Object.}, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 length |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Max length of this record type. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
has length => ( |
103
|
|
|
|
|
|
|
is => 'ro', |
104
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
105
|
|
|
|
|
|
|
reader => 'get_length', |
106
|
|
|
|
|
|
|
documentation => q{Max length of this record type.}, |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 type |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Corresponds to xDT record type string. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
has type => ( |
116
|
|
|
|
|
|
|
is => 'ro', |
117
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
118
|
|
|
|
|
|
|
reader => 'get_type', |
119
|
|
|
|
|
|
|
documentation => q{Corresponds to xDT record type string.}, |
120
|
|
|
|
|
|
|
); |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 is_object_end |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Checks if this record type is an ending record |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
my $self = shift; |
131
|
|
|
|
|
|
|
|
132
|
38
|
|
|
38
|
1
|
294
|
return $self->get_id == END_RECORD_ID; |
133
|
|
|
|
|
|
|
} |
134
|
38
|
|
|
|
|
879
|
|
135
|
|
|
|
|
|
|
=head2 get_id |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Returns the id of this record type. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head2 get_labels |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Returns the labels of this record type. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 get_accessor |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Returns the accessor of this record type. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=cut |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 get_length |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Returns the maximum length of this recourd type. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 build_from_arrayref |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Constructs a C<RecordType> from a arrayref containing configurations. |
162
|
|
|
|
|
|
|
This method will propagate the hashref, that contains the provided id, to the C<new> method. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
my $id = shift // die 'Error: parameter $id missing.'; |
167
|
|
|
|
|
|
|
my $arrayref = shift; |
168
|
|
|
|
|
|
|
my $config; |
169
|
36
|
|
50
|
36
|
1
|
139
|
|
170
|
36
|
|
|
|
|
60
|
($config) = grep { $_->{id} eq $id } @$arrayref |
171
|
36
|
|
|
|
|
43
|
if ($arrayref); |
172
|
|
|
|
|
|
|
|
173
|
36
|
100
|
|
|
|
80
|
$config = { id => $id, accessor => $id } unless ($config); |
|
768
|
|
|
|
|
1356
|
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
return xDT::RecordType->new($config); |
176
|
36
|
100
|
|
|
|
101
|
} |
177
|
|
|
|
|
|
|
|
178
|
36
|
|
|
|
|
823
|
|
179
|
|
|
|
|
|
|
my ($self, $id) = @_; |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
die(sprintf("Error: attribute 'id' has length %d (should be %d).", length $id, LENGTH)) |
182
|
|
|
|
|
|
|
unless (length $id == LENGTH); |
183
|
42
|
|
|
42
|
|
111
|
} |
184
|
|
|
|
|
|
|
|
185
|
42
|
100
|
|
|
|
1081
|
=head1 AUTHOR |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Christoph Beger, C<< <christoph.beger at medizin.uni-leipzig.de> >> |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
1; # End of xDT::RecordType |