blib/lib/MS2/Header.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 24 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 76 SCAR 52.0
CC
13
Cov
0%
parse
182.0
BEGIN
2.0
BEGIN
2.0
CRAP 182.0
1 #
2 #===============================================================================
3 #
4 # FILE: Header.pm
5 #
6 # DESCRIPTION: Representativa class for MS2 file headers.
7 #
8 # FILES: ---
9 # BUGS: ---
10 # NOTES: ---
11 # AUTHOR: Felipe da Veiga Leprevost (Leprevost, F.V.), leprevost@cpan.org
12 # ORGANIZATION:
13 # VERSION: 1.0
14 # CREATED: 07-10-2014 10:53:06
15 # REVISION: ---
16 #===============================================================================
17  
18 package MS2::Header;
19  
20 use strict;
21 use warnings;
22 use v5.12;
23 use Moose;
24 use namespace::autoclean;
25  
26 has 'CreationDate' => (
27 is => 'rw',
28 isa => 'Str',
29 );
30  
31 has 'Extractor' => (
32 is => 'rw',
33 isa => 'Str',
34 );
35  
36 has 'ExtractorVersion' => (
37 is => 'rw',
38 isa => 'Str',
39 );
40  
41 has 'Comments' => (
42 is => 'rw',
43 isa => 'Str',
44 );
45  
46 has 'ExtractorOptions' => (
47 is => 'rw',
48 isa => 'Str',
49 );
50  
51 has 'AcquisitionMethod' => (
52 is => 'rw',
53 isa => 'Str',
54 );
55  
56 has 'InstrumentType' => (
57 is => 'rw',
58 isa => 'Str',
59 );
60  
61 has 'ScanType' => (
62 is => 'rw',
63 isa => 'Str',
64 );
65  
66 has 'DataType' => (
67 is => 'rw',
68 isa => 'Str',
69 );
70  
71 has 'IsolationWindow' => (
72 is => 'rw',
73 isa => 'Any',
74 );
75  
76 has 'FirstScan' => (
77 is => 'rw',
78 isa => 'Str',
79 );
80  
81 has 'LastScan' => (
82 is => 'rw',
83 isa => 'Str',
84 );
85  
86  
87 sub parse {
88 my $self = shift;
89 my $line = shift;
90  
91 my @linepart = split(/\t/, $line);
92  
93 chomp $linepart[1];
94  
95 if ( $linepart[1] eq 'CreationDate' ) {
96  
97 $self->CreationDate($linepart[2]);
98  
99 } elsif ( $linepart[1] eq 'Extractor' ) {
100  
101 $self->Extractor($linepart[2]);
102  
103 } elsif ( $linepart[1] eq 'ExtractorVersion' ) {
104  
105 $self->ExtractorVersion($linepart[2]);
106  
107 } elsif ( $linepart[1] eq 'Comments' ) {
108  
109 $self->Comments($linepart[2]);
110  
111 } elsif ( $linepart[1] eq 'ExtractorOptions' ) {
112  
113 $self->ExtractorOptions($linepart[2]);
114  
115 } elsif ( $linepart[1] eq 'AcquisitionMethod' ) {
116  
117 $self->AcquisitionMethod($linepart[2]);
118  
119 } elsif ( $linepart[1] eq 'InstrumentType' ) {
120  
121 $self->InstrumentType($linepart[2]);
122  
123 } elsif ( $linepart[1] eq 'ScanType' ) {
124  
125 $self->ScanType($linepart[2]);
126  
127 } elsif ( $linepart[1] eq 'DataType' ) {
128  
129 $self->DataType($linepart[2]);
130  
131 } elsif ( $linepart[1] eq 'IsolationWindow' ) {
132  
133 $self->IsolationWindow($linepart[2]);
134  
135 } elsif ( $linepart[1] eq 'FirstScan' ) {
136  
137 $self->FirstScan($linepart[2]);
138  
139 } elsif ( $linepart[1] eq 'LastScan' ) {
140  
141 $self->LastScan($linepart[2]);
142  
143 } else {
144  
145 say "\nUnrecognized Tag: $linepart[1] ignored\n";
146 }
147  
148 }
149
150  
151 1;