| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ODS::Table::Column::Hash; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
15
|
use YAOO; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'ODS::Table::Column::Base'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
339
|
use ODS::Utils qw/clone error/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has reference => isa(boolean); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has required_keys => isa(array); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has serialize_class => isa(object); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub validation { |
|
16
|
6
|
50
|
50
|
6
|
0
|
65
|
if (ref($_[1] || "") ne 'HASH') { |
|
17
|
0
|
|
|
|
|
0
|
croak sprintf "The value passed to the %s column does not match the hash constraint.", |
|
18
|
|
|
|
|
|
|
$_[0]->name; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
6
|
|
|
|
|
8
|
my @missing; |
|
21
|
6
|
0
|
33
|
|
|
16
|
if ( |
|
22
|
|
|
|
|
|
|
$_[0]->required_keys && do { |
|
23
|
0
|
|
|
|
|
0
|
@missing = grep { ! defined $_[1]->{$_} } @{$_[0]->required_keys}; |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
24
|
0
|
|
|
|
|
0
|
@missing; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
) { |
|
27
|
0
|
|
|
|
|
0
|
croak sprintf "The % column array length is missing the following required keys %s.", |
|
28
|
|
|
|
|
|
|
$_[0]->name, join ", ", @missing; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
6
|
|
|
|
|
63
|
return $_[1]; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub inflation { |
|
34
|
0
|
|
|
0
|
0
|
0
|
my ($self, $value) = @_; |
|
35
|
0
|
0
|
|
|
|
0
|
if (! ref $value) { |
|
36
|
0
|
|
|
|
|
0
|
$value = $self->serialize_class->parse($value); |
|
37
|
0
|
|
|
|
|
0
|
$self->reference(1); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
0
|
|
|
|
|
0
|
return $value; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub deflation { |
|
43
|
4
|
|
|
4
|
0
|
40
|
my ($self, $value) = @_; |
|
44
|
4
|
50
|
33
|
|
|
11
|
if ($self->reference && ref $value) { |
|
45
|
0
|
|
|
|
|
0
|
$value = $self->serialize_class->stringify($value); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
4
|
|
|
|
|
49
|
return $value; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |