| 1 | package ODS::Table::Column::Hash; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use YAOO; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | extends 'ODS::Table::Column::Base'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use ODS::Utils qw/clone error/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | has reference => isa(boolean); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | has required_keys => isa(array); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | has serialize_class => isa(object); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | sub validation { | ||||||||||||||||||||||||||||
| 16 | 6 | ▶ | if (ref($_[1] || "") ne 'HASH') { | ||||||||||||||||||||||||||
|
Subroutine
validation: called CC=5 SCAR=22.9
Pod
undocumented
Branch: 1 branch
Condition50%1/2
$_[1] || ''
MC/DC0%0/1
$_[1] || ''
$_[1]
Truth table50%1/2
A
A= $_[1]
| |||||||||||||||||||||||||||||
| 17 | 0 | croak sprintf "The value passed to the %s column does not match the hash constraint.", | |||||||||||||||||||||||||||
| 18 | $_[0]->name; | ||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | 6 | my @missing; | |||||||||||||||||||||||||||
| 21 | 6 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_[0]->required_keys and do {
@missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;});
@missing
}
MC/DC0%0/2
$_[0]->required_keys and do {
@missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;});
@missing
}
$_[0]->required_keys
do {
@missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;});
@missing
}
Truth table33%1/3
A and B
A= $_[0]->required_keysB= do {
@missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;});
@missing
}
| |||||||||||||||||||||||||||||
| 22 | $_[0]->required_keys && do { | ||||||||||||||||||||||||||||
| 23 | 0 | @missing = grep { ! defined $_[1]->{$_} } @{$_[0]->required_keys}; | |||||||||||||||||||||||||||
| 24 | 0 | @missing; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | ) { | ||||||||||||||||||||||||||||
| 27 | 0 | croak sprintf "The % column array length is missing the following required keys %s.", | |||||||||||||||||||||||||||
| 28 | $_[0]->name, join ", ", @missing; | ||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | 6 | return $_[1]; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub inflation { | ||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my ($self, $value) = @_; | ||||||||||||||||||||||||||
|
Subroutine
inflation: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if (! ref $value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 0 | $value = $self->serialize_class->parse($value); | |||||||||||||||||||||||||||
| 37 | 0 | $self->reference(1); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 0 | return $value; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | sub deflation { | ||||||||||||||||||||||||||||
| 43 | 4 | ▶ | my ($self, $value) = @_; | ||||||||||||||||||||||||||
|
Subroutine
deflation: called CC=3 SCAR=13.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | 4 | ▶ | if ($self->reference && ref $value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->reference and ref $value
MC/DC0%0/2
$self->reference and ref $value
$self->reference
ref $value
Truth table33%1/3
A and B
A= $self->referenceB= ref $value
| |||||||||||||||||||||||||||||
| 45 | 0 | $value = $self->serialize_class->stringify($value); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 4 | return $value; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 1 | 1; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||