| 1 | package SVG::VCD; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use IO::File; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use SVG::VCD::Taxon; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | our $VERSION = 0.4; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 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 | 0 | ▶ | sub parse { | ||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 28 | 0 | my $this = shift(); | |||||||||||||||||||||||||||
| 29 | 0 | my $filename = $this->{filename}; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $f = new IO::File("<$filename") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | or die "$0: can't open VCD-file '$filename': $!"; | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | my %fields = (); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | while (my $line = <$f>) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | chomp $line; | |||||||||||||||||||||||||||
| 38 | 0 | $line =~ s/^\s+//; | |||||||||||||||||||||||||||
| 39 | 0 | $line =~ s/#.*//; | |||||||||||||||||||||||||||
| 40 | 0 | $line =~ s/\s+$//; | |||||||||||||||||||||||||||
| 41 | 0 | ▶ | next if $line eq ""; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 0 | my($star, $key, $value) = ($line =~ /^(\*?)([a-z0-9_-]+):\s*(.*)/i); | |||||||||||||||||||||||||||
| 43 | 0 | ▶ | die "$0: $filename: bad line: '$line'" if !defined $key || $key eq ""; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $key or $key eq ""
MC/DC0%0/2
not defined $key or $key eq ""
not defined $key
$key eq ""
Truth table0%0/3
not(A) or B
A= not defined $keyB= $key eq ""
| |||||||||||||||||||||||||||||
| 44 | 0 | $key = lc($key); | |||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ($star) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 0 | $this->{config}->{$key} = $value; | |||||||||||||||||||||||||||
| 47 | 0 | next; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ($key eq "taxon" && keys %fields > 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$key eq "taxon" and keys %fields > 1
MC/DC0%0/2
$key eq "taxon" and keys %fields > 1
$key eq "taxon"
keys %fields > 1
Truth table0%0/3
A and B
A= $key eq "taxon"B= keys %fields > 1
| |||||||||||||||||||||||||||||
| 50 | 0 | push @{ $this->{taxa} }, new SVG::VCD::Taxon(%fields); | |||||||||||||||||||||||||||
| 51 | 0 | %fields = (); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | 0 | $fields{$key} = $value; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | push @{ $this->{taxa} }, new SVG::VCD::Taxon(%fields); | |||||||||||||||||||||||||||
| 57 | 0 | $f->close(); | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub config { | ||||||||||||||||||||||||||
|
Subroutine
config: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | 0 | my $this = shift(); | |||||||||||||||||||||||||||
| 63 | 0 | my($key) = @_; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | return $this->{config}->{$key}; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub ntaxa { | ||||||||||||||||||||||||||
|
Subroutine
ntaxa: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 70 | 0 | my $this = shift(); | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | return scalar @{ $this->{taxa} }; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub taxon { | ||||||||||||||||||||||||||
|
Subroutine
taxon: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | 0 | my $this = shift(); | |||||||||||||||||||||||||||
| 78 | 0 | my($i) = @_; | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 0 | return $this->{taxa}->[$i]; | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 1 | 1; | |||||||||||||||||||||||||||