line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Parse::Taxonomy::Auxiliary; |
2
|
8
|
|
|
8
|
|
39
|
use strict; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
212
|
|
3
|
8
|
|
|
8
|
|
35
|
use Carp; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
2583
|
|
4
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK); |
5
|
|
|
|
|
|
|
$VERSION = '0.22'; |
6
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
7
|
|
|
|
|
|
|
@EXPORT_OK = qw( |
8
|
|
|
|
|
|
|
path_check_fields |
9
|
|
|
|
|
|
|
components_check_fields |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Parse::Taxonomy::Auxiliary - Utility subroutines for Parse::Taxonomy |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Parse::Taxonomy::Auxiliary qw( |
19
|
|
|
|
|
|
|
path_check_fields |
20
|
|
|
|
|
|
|
components_check_fields |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SUBROUTINES |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub path_check_fields { |
30
|
49
|
|
|
49
|
0
|
87
|
my ($data, $fields_ref) = @_; |
31
|
49
|
|
|
|
|
148
|
_check_fields($data, $fields_ref, 0); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub components_check_fields { |
35
|
33
|
|
|
33
|
0
|
59
|
my ($data, $fields_ref) = @_; |
36
|
33
|
|
|
|
|
75
|
_check_fields($data, $fields_ref, 1); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _check_fields { |
40
|
82
|
|
|
82
|
|
120
|
my ($data, $fields_ref, $components) = @_; |
41
|
82
|
|
|
|
|
117
|
my %header_fields_seen; |
42
|
82
|
|
|
|
|
113
|
for my $f (@{$fields_ref}) { |
|
82
|
|
|
|
|
195
|
|
43
|
503
|
100
|
|
|
|
999
|
if (exists $header_fields_seen{$f}) { |
44
|
4
|
|
|
|
|
10
|
my $error_msg = ''; |
45
|
4
|
100
|
|
|
|
15
|
if ($components) { |
46
|
2
|
|
|
|
|
7
|
$error_msg = "Duplicate field '$f' observed in 'fields' array ref"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else { |
49
|
2
|
|
|
|
|
10
|
$error_msg = "Duplicate field '$f' observed in '$data->{file}'"; |
50
|
|
|
|
|
|
|
} |
51
|
4
|
|
|
|
|
596
|
croak $error_msg; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else { |
54
|
499
|
|
|
|
|
1222
|
$header_fields_seen{$f}++; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# vim: formatoptions=crqot |