| 1 | package ODS::Storage::Base; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 72 | ▶ | use YAOO; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | 72 | ▶ | use ODS::Iterator; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 72 | auto_build; | |||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 72 | has table => isa(object); | |||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | 72 | has serialize_class => isa(object); | |||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | sub connect { | ||||||||||||||||||||||||||||||||
| 14 | 142 | ▶ | my ($self, %params) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
connect: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 15 | 142 | $self = $self->new(%params); | |||||||||||||||||||||||||||||||
| 16 | 142 | return $self; | |||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | sub into_rows { | ||||||||||||||||||||||||||||||||
| 20 | 1765 | ▶ | my ($self, $data, $inflated) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
into_rows: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 1765 | ▶ | $data = $self->parse_data_format($data) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not ref $data and $self->can("parse_data_format")
MC/DC50%1/2
not ref $data and $self->can("parse_data_format")
not ref $data
$self->can("parse_data_format")
Truth table66%2/3
not(A) and B
A= not ref $dataB= $self->can("parse_data_format")
| |||||||||||||||||||||||||||||||||
| 23 | if (not ref $data and $self->can('parse_data_format')); | ||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | 1765 | ▶ | if (ref $data eq 'ARRAY') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 26 | 46 | my @rows; | |||||||||||||||||||||||||||||||
| 27 | 46 | for my $row ( @{ $data } ) { | |||||||||||||||||||||||||||||||
| 28 | 922 | ▶ | push @rows, $self->table->row_class->new( | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$inflated || 0
MC/DC0%0/1
$inflated || 0
$inflated
Truth table50%1/2
A
A= $inflated
| |||||||||||||||||||||||||||||||||
| 29 | table => $self->table, | ||||||||||||||||||||||||||||||||
| 30 | data => $row, | ||||||||||||||||||||||||||||||||
| 31 | inflated => $inflated || 0, | ||||||||||||||||||||||||||||||||
| 32 | serialize_class => $self->serialize_class | ||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||
| 35 | 46 | $self->table->rows(\@rows); | |||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | 46 | return ODS::Iterator->new(table => $self->table); | |||||||||||||||||||||||||||||||
| 38 | } elsif (ref $data eq 'HASH') { | ||||||||||||||||||||||||||||||||
| 39 | 1718 | ▶ | return $self->table->row_class->new( | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$inflated || 0
MC/DC0%0/1
$inflated || 0
$inflated
Truth table50%1/2
A
A= $inflated
| |||||||||||||||||||||||||||||||||
| 40 | table => $self->table, | ||||||||||||||||||||||||||||||||
| 41 | data => $data, | ||||||||||||||||||||||||||||||||
| 42 | inflated => $inflated || 0, | ||||||||||||||||||||||||||||||||
| 43 | serialize_class => $self->serialize_class | ||||||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 1 | return undef; | |||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||
| 50 | sub into_storage { | ||||||||||||||||||||||||||||||||
| 51 | 1728 | ▶ | my ($self, $all) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
into_storage: called CC=7 SCAR=20.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | 1728 | my $data; | |||||||||||||||||||||||||||||||
| 54 | 1728 | ▶ | if ($all && !ref $all) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$all and not ref $all
MC/DC50%1/2
$all and not ref $all
$all
not ref $all
Truth table66%2/3
A and not(B)
A= $allB= not ref $all
| |||||||||||||||||||||||||||||||||
| 55 | 12 | for my $row (@{ $self->table->rows }) { | |||||||||||||||||||||||||||||||
| 56 | 44 | my $val = $row->store_row(); | |||||||||||||||||||||||||||||||
| 57 | 44 | push @{$data}, $val; | |||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||
| 59 | } elsif ($all) { | ||||||||||||||||||||||||||||||||
| 60 | 1716 | $data = $all->store_row(); | |||||||||||||||||||||||||||||||
| 61 | } else { | ||||||||||||||||||||||||||||||||
| 62 | 0 | $data = $self->table->rows->[-1]->store_row(); | |||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | 1728 | ▶ | $data = $self->stringify_data_format($data) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $data and $self->can("stringify_data_format")
MC/DC0%0/2
ref $data and $self->can("stringify_data_format")
ref $data
$self->can("stringify_data_format")
Truth table33%1/3
A and B
A= ref $dataB= $self->can("stringify_data_format")
| |||||||||||||||||||||||||||||||||
| 66 | if (ref $data and $self->can('stringify_data_format')); | ||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | 1728 | return $data; | |||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||
| 71 | 72 | 1; | |||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||