line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVG::VCD; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20059
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
869
|
use IO::File; |
|
1
|
|
|
|
|
9791
|
|
|
1
|
|
|
|
|
110
|
|
6
|
1
|
|
|
1
|
|
457
|
use SVG::VCD::Taxon; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
488
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.4; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
0
|
|
|
0
|
0
|
|
my $class = shift(); |
14
|
0
|
|
|
|
|
|
my($filename) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $this = bless { |
17
|
|
|
|
|
|
|
filename => $filename, |
18
|
|
|
|
|
|
|
config => {}, |
19
|
|
|
|
|
|
|
taxa => [], |
20
|
|
|
|
|
|
|
}, $class; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
$this->parse(); |
23
|
0
|
|
|
|
|
|
return $this; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub parse { |
28
|
0
|
|
|
0
|
0
|
|
my $this = shift(); |
29
|
0
|
|
|
|
|
|
my $filename = $this->{filename}; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
my $f = new IO::File("<$filename") |
32
|
|
|
|
|
|
|
or die "$0: can't open VCD-file '$filename': $!"; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my %fields = (); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
while (my $line = <$f>) { |
37
|
0
|
|
|
|
|
|
chomp $line; |
38
|
0
|
|
|
|
|
|
$line =~ s/^\s+//; |
39
|
0
|
|
|
|
|
|
$line =~ s/#.*//; |
40
|
0
|
|
|
|
|
|
$line =~ s/\s+$//; |
41
|
0
|
0
|
|
|
|
|
next if $line eq ""; |
42
|
0
|
|
|
|
|
|
my($star, $key, $value) = ($line =~ /^(\*?)([a-z0-9_-]+):\s*(.*)/i); |
43
|
0
|
0
|
0
|
|
|
|
die "$0: $filename: bad line: '$line'" if !defined $key || $key eq ""; |
44
|
0
|
|
|
|
|
|
$key = lc($key); |
45
|
0
|
0
|
|
|
|
|
if ($star) { |
46
|
0
|
|
|
|
|
|
$this->{config}->{$key} = $value; |
47
|
0
|
|
|
|
|
|
next; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
0
|
0
|
|
|
|
if ($key eq "taxon" && keys %fields > 1) { |
50
|
0
|
|
|
|
|
|
push @{ $this->{taxa} }, new SVG::VCD::Taxon(%fields); |
|
0
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
%fields = (); |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
|
$fields{$key} = $value; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
push @{ $this->{taxa} }, new SVG::VCD::Taxon(%fields); |
|
0
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$f->close(); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub config { |
62
|
0
|
|
|
0
|
0
|
|
my $this = shift(); |
63
|
0
|
|
|
|
|
|
my($key) = @_; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
return $this->{config}->{$key}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub ntaxa { |
70
|
0
|
|
|
0
|
0
|
|
my $this = shift(); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
return scalar @{ $this->{taxa} }; |
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub taxon { |
77
|
0
|
|
|
0
|
0
|
|
my $this = shift(); |
78
|
0
|
|
|
|
|
|
my($i) = @_; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return $this->{taxa}->[$i]; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |