line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Container Class for Data Input Parameters |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Validation::Class::Params is a container class for input parameters and is |
4
|
|
|
|
|
|
|
# derived from the L class. |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Validation::Class::Params; |
7
|
|
|
|
|
|
|
|
8
|
108
|
|
|
108
|
|
533
|
use strict; |
|
108
|
|
|
|
|
207
|
|
|
108
|
|
|
|
|
2805
|
|
9
|
108
|
|
|
108
|
|
530
|
use warnings; |
|
108
|
|
|
|
|
192
|
|
|
108
|
|
|
|
|
2985
|
|
10
|
|
|
|
|
|
|
|
11
|
108
|
|
|
108
|
|
555
|
use Validation::Class::Util '!has'; |
|
108
|
|
|
|
|
190
|
|
|
108
|
|
|
|
|
740
|
|
12
|
108
|
|
|
108
|
|
584
|
use Hash::Flatten (); |
|
108
|
|
|
|
|
204
|
|
|
108
|
|
|
|
|
2218
|
|
13
|
108
|
|
|
108
|
|
534
|
use Carp 'confess'; |
|
108
|
|
|
|
|
214
|
|
|
108
|
|
|
|
|
6810
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '7.900057'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
108
|
|
|
108
|
|
561
|
use base 'Validation::Class::Mapping'; |
|
108
|
|
|
|
|
199
|
|
|
108
|
|
|
|
|
8345
|
|
18
|
|
|
|
|
|
|
|
19
|
108
|
|
|
108
|
|
612
|
use Validation::Class::Mapping; |
|
108
|
|
|
|
|
244
|
|
|
108
|
|
|
|
|
31113
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub add { |
22
|
|
|
|
|
|
|
|
23
|
1536
|
|
|
1536
|
1
|
2295
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
1536
|
|
|
|
|
4847
|
my $arguments = $self->build_args(@_); |
26
|
|
|
|
|
|
|
|
27
|
1536
|
|
|
|
|
2549
|
while (my ($key, $value) = each %{$arguments}) { |
|
2983
|
|
|
|
|
10435
|
|
28
|
|
|
|
|
|
|
|
29
|
1448
|
100
|
100
|
|
|
7131
|
confess |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
"A parameter value must be a string or an array of strings, all " . |
32
|
|
|
|
|
|
|
"other structures are illegal" |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
unless ("ARRAY" eq (ref($value) || "ARRAY")) |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
; |
37
|
|
|
|
|
|
|
|
38
|
1447
|
|
|
|
|
3518
|
$self->{$key} = $value; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
confess |
43
|
|
|
|
|
|
|
|
44
|
1535
|
50
|
|
|
|
3958
|
"Parameter values must be strings, arrays of strings, or hashrefs " . |
45
|
|
|
|
|
|
|
"whose values are any of the previously mentioned values, i.e. an " . |
46
|
|
|
|
|
|
|
"array with nested structures is illegal" |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
if $self->flatten->grep(qr/(:.*:|:\d+.)/)->count |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
; |
51
|
|
|
|
|
|
|
|
52
|
1535
|
|
|
|
|
16513
|
return $self; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub flatten { |
57
|
|
|
|
|
|
|
|
58
|
1535
|
|
|
1535
|
0
|
2300
|
my ($self) = @_; |
59
|
|
|
|
|
|
|
|
60
|
1535
|
|
|
|
|
4942
|
return Validation::Class::Mapping->new( |
61
|
|
|
|
|
|
|
Hash::Flatten::flatten($self->hash) |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub unflatten { |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
5
|
return Validation::Class::Mapping->new( |
71
|
|
|
|
|
|
|
Hash::Flatten::unflatten($self->hash) |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |