ODS/Table/Column/Object.pm

filter: Statementstmt 91.1% 31 / 34 Branchbran 60.0% 6 / 10 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 73.7% 45 / 61 CC 8 SCAR 11.7
CC
8
Cov
80%
deflation
4.9
inflation
3.3
validation
3.0
CRAP 3.2
« ODS/Table/Column/Boolean.pm ↑ Summary ODS/Storage/File.pm »
1 package ODS::Table::Column::Object;
2  
3 1 ▶use YAOO;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Scalar::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 extends 'ODS::Table::Column::Base';
8  
9 1 ▶use ODS::Utils qw/clone error deep_unblessed/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 has reference => isa(boolean), default => 0;
12  
13 1 has blessed => isa(boolean), default => 0;
14  
15 1 has object_class => isa(string);
16  
17 1 has serialize_class => isa(object);
18  
19 sub validation {
20 6 ▶ my ($self, $value) = @_;
Subroutine validation: called CC=3 SCAR=11.0
Pod undocumented
21 6 ▶ if (ref($value || "SCALAR") =~ m/ARRAY|HASH|SCALAR/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($value or "SCALAR") =~ /ARRAY|HASH|SCALAR/) 4 2 6
Condition50%1/2
$value || 'SCALAR'
l!l
60
MC/DC0%0/1
$value || 'SCALAR'
$value
Truth table50%1/2
A
A= $value
Aresult
11
00
22 4 $value = $self->object_class->instantiate($self, 0, $value);
23 4 $self->blessed(1);
24 }
25 6 return $value;
26 }
27  
28 sub inflation {
29 4 ▶ my ($self, $value) = @_;
Subroutine inflation: called CC=3 SCAR=12.0
Pod undocumented
30  
31 4 ▶ if (! ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $value) 0 4 4
32 0 $value = $self->serialize_class->parse($value);
33 0 $self->reference(1);
34 }
35  
36 4 ▶ return ref($value) =~ m/HASH|ARRAY|SCALAR/ ? do {
Branch: 1 branch
BranchTrueFalseTotal
ref($value) =~ /HASH|ARRAY|SCALAR/ ? : 4 0 4
37 4 $self->blessed(1);
38 4 $value = $self->object_class->instantiate($self, 0, $value);
39 4 $value;
40 } : $value;
41 }
42  
43 sub deflation {
44 4 ▶ my ($self, $value) = @_;
Subroutine deflation: called CC=4 SCAR=15.9
Pod undocumented
45 4 ▶ if ($self->blessed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->blessed) 4 0 4
46 4 $value = deep_unblessed $value;
47 }
48 4 ▶ if ($self->reference && ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->reference and ref $value) 0 4 4
Condition33%1/3
$self->reference and ref $value
!ll&&!rl&&r
400
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
ABresult
0X0
100
111
49 0 $value = $self->serialize_class->stringify($value);
50 }
51 4 return $value;
52 }
53  
54 1 1;
55  
56 __END__
« ODS/Table/Column/Boolean.pm ↑ Summary ODS/Storage/File.pm »