line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ODS::Table::Column::Array; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use YAOO; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'ODS::Table::Column::Base'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
291
|
use ODS::Utils qw/clone error/; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has reference => isa(boolean); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has min_length => isa(integer); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has max_length => isa(integer); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has serialize_class => isa(object); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub validation { |
18
|
6
|
50
|
50
|
6
|
0
|
64
|
if (ref($_[1] || "") ne 'ARRAY') { |
19
|
0
|
|
|
|
|
0
|
croak sprintf "The value passed to the %s column does not match the array constraint.", |
20
|
|
|
|
|
|
|
$_[0]->name; |
21
|
|
|
|
|
|
|
} |
22
|
6
|
50
|
33
|
|
|
17
|
if ($_[0]->min_length && $_[0]->min_length > scalar @{$_[1]}) { |
|
0
|
|
|
|
|
0
|
|
23
|
0
|
|
|
|
|
0
|
croak sprintf "The % column array length is less than the minimum allowed length for the attribute.", |
24
|
|
|
|
|
|
|
$_[0]->name; |
25
|
|
|
|
|
|
|
} |
26
|
6
|
50
|
33
|
|
|
64
|
if ($_[0]->max_length && $_[0]->max_length < scalar @{$_[1]}) { |
|
0
|
|
|
|
|
0
|
|
27
|
0
|
|
|
|
|
0
|
croak sprintf "The % column array length is greater than the maximum allowed length for the attribute.", |
28
|
|
|
|
|
|
|
$_[0]->name; |
29
|
|
|
|
|
|
|
} |
30
|
6
|
|
|
|
|
68
|
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
|
67
|
my ($self, $value) = @_; |
44
|
4
|
50
|
33
|
|
|
14
|
if ($self->reference && ref $value) { |
45
|
0
|
|
|
|
|
0
|
$value = $self->serialize_class->stringify($value); |
46
|
|
|
|
|
|
|
} |
47
|
4
|
|
|
|
|
44
|
return $value; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |