line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Parse::Taxonomy::Auxiliary; |
2
|
8
|
|
|
8
|
|
25
|
use strict; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
232
|
|
3
|
8
|
|
|
8
|
|
21
|
use Carp; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
1616
|
|
4
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK); |
5
|
|
|
|
|
|
|
$VERSION = '0.23'; |
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
|
43
|
|
|
43
|
0
|
42
|
my ($data, $fields_ref) = @_; |
31
|
43
|
|
|
|
|
71
|
_check_fields($data, $fields_ref, 0); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub components_check_fields { |
35
|
26
|
|
|
26
|
0
|
25
|
my ($data, $fields_ref) = @_; |
36
|
26
|
|
|
|
|
40
|
_check_fields($data, $fields_ref, 1); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _check_fields { |
40
|
69
|
|
|
69
|
|
61
|
my ($data, $fields_ref, $components) = @_; |
41
|
69
|
|
|
|
|
60
|
my %header_fields_seen; |
42
|
69
|
|
|
|
|
53
|
for my $f (@{$fields_ref}) { |
|
69
|
|
|
|
|
110
|
|
43
|
429
|
100
|
|
|
|
422
|
if (exists $header_fields_seen{$f}) { |
44
|
4
|
|
|
|
|
5
|
my $error_msg = ''; |
45
|
4
|
100
|
|
|
|
10
|
if ($components) { |
46
|
2
|
|
|
|
|
7
|
$error_msg = "Duplicate field '$f' observed in 'fields' array ref"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else { |
49
|
2
|
|
|
|
|
6
|
$error_msg = "Duplicate field '$f' observed in '$data->{file}'"; |
50
|
|
|
|
|
|
|
} |
51
|
4
|
|
|
|
|
430
|
croak $error_msg; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else { |
54
|
425
|
|
|
|
|
590
|
$header_fields_seen{$f}++; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# vim: formatoptions=crqot |