line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finnigan::GenericRecord; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings FATAL => qw( all ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
80
|
|
5
|
|
|
|
|
|
|
our $VERSION = 0.0206; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
9
|
use Finnigan; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
43
|
|
8
|
2
|
|
|
2
|
|
9
|
use base 'Finnigan::Decoder'; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
281
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub decode { |
11
|
34
|
|
|
34
|
1
|
52
|
my ($class, $stream, $field_templates) = @_; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# This is a sleazy way of decoding this structure. The result will |
14
|
|
|
|
|
|
|
# be a hash whose keys start with the ordinal numbers of elements; |
15
|
|
|
|
|
|
|
# this answers the need to preserve order and to introduce gaps and |
16
|
|
|
|
|
|
|
# section titles commanded by the GenericDataHeader but not present |
17
|
|
|
|
|
|
|
# in the actual record. The field_templates() method of |
18
|
|
|
|
|
|
|
# GenericDataHeader modifies all keys by adding ordinals to them. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# To decode a combination of specific and generic content, simply |
21
|
|
|
|
|
|
|
# create a copy of this object and in it, combine |
22
|
|
|
|
|
|
|
# $header->field_templates with specific fields and call |
23
|
|
|
|
|
|
|
# Decoder->read. Just make sure the specific fields' keys start with |
24
|
|
|
|
|
|
|
# a number and have the form 'x|key', and that number is unique in |
25
|
|
|
|
|
|
|
# each field (does not co-incide with the range of numbers in the |
26
|
|
|
|
|
|
|
# header (which is 1 .. n). |
27
|
34
|
|
|
|
|
98
|
my $self = Finnigan::Decoder->read($stream, $field_templates); |
28
|
34
|
|
|
|
|
559
|
return bless $self, $class; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
__END__ |