line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ODS::Table::Column::Array; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use YAOO; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'ODS::Table::Column::Base'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
723
|
use ODS::Utils qw/clone error/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
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
|
8
|
50
|
50
|
8
|
0
|
88
|
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
|
8
|
50
|
33
|
|
|
25
|
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
|
8
|
50
|
33
|
|
|
105
|
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
|
8
|
|
|
|
|
76
|
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
|
5
|
|
|
5
|
0
|
48
|
my ($self, $value) = @_; |
44
|
5
|
50
|
33
|
|
|
13
|
if ($self->reference && ref $value) { |
45
|
0
|
|
|
|
|
0
|
$value = $self->serialize_class->stringify($value); |
46
|
|
|
|
|
|
|
} |
47
|
5
|
|
|
|
|
49
|
return $value; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |