line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ODS::Table::Column::Object; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use YAOO; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
594
|
use Scalar::Util; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
147
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'ODS::Table::Column::Base'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
12
|
use ODS::Utils qw/clone error deep_unblessed/; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
13
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has reference => isa(boolean), default => 0; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has blessed => isa(boolean), default => 0; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has object_class => isa(string); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has serialize_class => isa(object); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub validation { |
20
|
6
|
|
|
6
|
0
|
65
|
my ($self, $value) = @_; |
21
|
6
|
100
|
50
|
|
|
52
|
if (ref($value || "SCALAR") =~ m/ARRAY|HASH|SCALAR/) { |
22
|
4
|
|
|
|
|
30
|
$value = $self->inflation($value); |
23
|
|
|
|
|
|
|
} |
24
|
6
|
|
|
|
|
16
|
return $value; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub inflation { |
28
|
11
|
|
|
11
|
0
|
87
|
my ($self, $value) = @_; |
29
|
|
|
|
|
|
|
|
30
|
11
|
50
|
|
|
|
26
|
if (! ref $value) { |
31
|
0
|
|
|
|
|
0
|
$value = $self->serialize_class->parse($value); |
32
|
0
|
|
|
|
|
0
|
$self->reference(1); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
11
|
50
|
|
|
|
56
|
return ref($value) =~ m/HASH|ARRAY|SCALAR/ ? do { |
36
|
11
|
|
|
|
|
31
|
$self->blessed(1); |
37
|
11
|
100
|
|
|
|
389
|
if (ref $value eq 'ARRAY') { |
38
|
3
|
|
|
|
|
6
|
$value = [ map { $self->object_class->instantiate($self, 0, $_) } @{ $value } ]; |
|
6
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
7
|
|
39
|
|
|
|
|
|
|
} else { |
40
|
8
|
|
|
|
|
17
|
$value = $self->object_class->instantiate($self, 0, $value); |
41
|
|
|
|
|
|
|
} |
42
|
11
|
|
|
|
|
38
|
$value; |
43
|
|
|
|
|
|
|
} : $value; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub deflation { |
47
|
4
|
|
|
4
|
0
|
37
|
my ($self, $value) = @_; |
48
|
4
|
50
|
|
|
|
9
|
if ($self->blessed) { |
49
|
4
|
|
|
|
|
45
|
$value = deep_unblessed $value; |
50
|
|
|
|
|
|
|
$value = { map { |
51
|
8
|
100
|
|
|
|
31
|
my $val = ref $value->{$_} ? $value->{$_}->store_row() : $value->{$_}; |
52
|
8
|
|
|
|
|
24
|
$_ => $val |
53
|
4
|
|
|
|
|
6
|
} keys %{ $value } }; |
|
4
|
|
|
|
|
8
|
|
54
|
|
|
|
|
|
|
} |
55
|
4
|
50
|
33
|
|
|
18
|
if ($self->reference && ref $value) { |
56
|
0
|
|
|
|
|
0
|
$value = $self->serialize_class->stringify($value); |
57
|
|
|
|
|
|
|
} |
58
|
4
|
|
|
|
|
43
|
return $value; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |