| 1 | package ODS::Storage::Base; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use YAOO; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use ODS::Iterator; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | auto_build; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | has table => isa(object); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub connect { | ||||||||||||||||||||||||||||
| 12 | 2 | ▶ | my ($self, @params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
connect: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 2 | $self = $self->new(@params); | |||||||||||||||||||||||||||
| 14 | 2 | return $self; | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | sub into_rows { | ||||||||||||||||||||||||||||
| 18 | 4 | ▶ | my ($self, $data, $inflated) = @_; | ||||||||||||||||||||||||||
|
Subroutine
into_rows: called CC=8 SCAR=21.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 4 | ▶ | $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")
| |||||||||||||||||||||||||||||
| 21 | if (not ref $data and $self->can('parse_data_format')); | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 4 | ▶ | if (ref $data eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 24 | 2 | my @rows; | |||||||||||||||||||||||||||
| 25 | 2 | for my $row ( @{ $data } ) { | |||||||||||||||||||||||||||
| 26 | 4 | ▶ | 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
| |||||||||||||||||||||||||||||
| 27 | table => $self->table, | ||||||||||||||||||||||||||||
| 28 | data => $row, | ||||||||||||||||||||||||||||
| 29 | inflated => $inflated || 0 | ||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | 2 | $self->table->rows(\@rows); | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 2 | return ODS::Iterator->new(table => $self->table); | |||||||||||||||||||||||||||
| 35 | } elsif (ref $data eq 'HASH') { | ||||||||||||||||||||||||||||
| 36 | 2 | ▶ | 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
| |||||||||||||||||||||||||||||
| 37 | table => $self->table, | ||||||||||||||||||||||||||||
| 38 | data => $data, | ||||||||||||||||||||||||||||
| 39 | inflated => $inflated || 0 | ||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | return undef; | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | sub into_storage { | ||||||||||||||||||||||||||||
| 47 | 6 | ▶ | my ($self, $all) = @_; | ||||||||||||||||||||||||||
|
Subroutine
into_storage: called CC=5 SCAR=17.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 6 | my $data; | |||||||||||||||||||||||||||
| 50 | 6 | ▶ | if ($all) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 6 | for my $row (@{ $self->table->rows }) { | |||||||||||||||||||||||||||
| 52 | 22 | my $val = $row->store_row(); | |||||||||||||||||||||||||||
| 53 | 22 | push @{$data}, $val; | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | } else { | ||||||||||||||||||||||||||||
| 56 | 0 | $data = $self->table->rows->[-1]->store_row(); | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 6 | ▶ | $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")
| |||||||||||||||||||||||||||||
| 60 | if (ref $data and $self->can('stringify_data_format')); | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 6 | return $data; | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 1 | 1; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||