| 1 | package GnaData::Conform::Hash; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | my $proto = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | my $inref = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | bless ($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | $self->{'myhash'} = {}; | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | $self->{'delete_blank'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | sub load { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | my ($self, $inhash) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | my ($field); | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | foreach $field (keys %$inhash) { | |||||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | $self->{'myhash'}->{lc($field)} = $inhash->{$field}; | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | sub load_reverse { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_reverse: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | my ($self, $inhash) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | my ($field); | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | foreach $field (keys %$inhash) { | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | my($result) = lc($inhash->{$field}); | |||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | $self->{'myhash'}->{$result} = $field; | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | ▶ | sub delete_blank { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_blank: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 2 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 | ▶ | if (defined($value)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | $self->{'delete_blank'} = $value; | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | return $self->{'delete_blank'}; | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 6 | ▶ | sub conform { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
conform: called CC=7 SCAR=19.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 6 | my ($self, $inhash) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | 6 | my (%outhash); | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | 6 | foreach $key (keys %{$inhash}) { | |||||||||||||||||||||||||||||||||||||||||||||
| 43 | 9 | my ($keyval) = ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | 9 | my ($keylc) = lc ($key); | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | 9 | ▶ | if (!defined ($self->{'myhash'}->{$keylc})) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $keyval = $key; | |||||||||||||||||||||||||||||||||||||||||||||
| 47 | } elsif ($self->{'myhash'}->{$keylc} ne "") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 9 | $keyval = $self->{'myhash'}->{$keylc}; | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $keyval = ""; | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 9 | ▶ | if ($keyval ne "" | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$keyval ne "" and $inhash->{$key} ne "" or $self->{"delete_blank"} == 0
$keyval ne "" and $inhash->{$key} ne ""
MC/DC66%2/3
$keyval ne "" and $inhash->{$key} ne "" or $self->{"delete_blank"} == 0
$keyval ne ""
$inhash->{$key} ne ""
$self->{"delete_blank"} == 0
Truth table60%3/5
A and B or C
A= $keyval ne ""B= $inhash->{$key} ne ""C= $self->{"delete_blank"} == 0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | && $inhash->{$key} ne "" | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | || $self->{'delete_blank'} == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | $outhash{$keyval} = | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 8 | $inhash->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 6 | %{$inhash} = %outhash; | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub deconform { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deconform: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||