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
|
109
|
|
|
109
|
|
652
|
use strict; |
|
109
|
|
|
|
|
191
|
|
|
109
|
|
|
|
|
2835
|
|
9
|
109
|
|
|
109
|
|
477
|
use warnings; |
|
109
|
|
|
|
|
190
|
|
|
109
|
|
|
|
|
2735
|
|
10
|
|
|
|
|
|
|
|
11
|
109
|
|
|
109
|
|
523
|
use Validation::Class::Util '!has'; |
|
109
|
|
|
|
|
195
|
|
|
109
|
|
|
|
|
577
|
|
12
|
109
|
|
|
109
|
|
556
|
use Hash::Flatten (); |
|
109
|
|
|
|
|
199
|
|
|
109
|
|
|
|
|
2011
|
|
13
|
109
|
|
|
109
|
|
489
|
use Carp 'confess'; |
|
109
|
|
|
|
|
230
|
|
|
109
|
|
|
|
|
6571
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '7.900058'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
109
|
|
|
109
|
|
653
|
use base 'Validation::Class::Mapping'; |
|
109
|
|
|
|
|
241
|
|
|
109
|
|
|
|
|
11607
|
|
18
|
|
|
|
|
|
|
|
19
|
109
|
|
|
109
|
|
705
|
use Validation::Class::Mapping; |
|
109
|
|
|
|
|
200
|
|
|
109
|
|
|
|
|
27290
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub add { |
22
|
|
|
|
|
|
|
|
23
|
1542
|
|
|
1542
|
1
|
2509
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
1542
|
|
|
|
|
3998
|
my $arguments = $self->build_args(@_); |
26
|
|
|
|
|
|
|
|
27
|
1542
|
|
|
|
|
2715
|
while (my ($key, $value) = each %{$arguments}) { |
|
2993
|
|
|
|
|
8957
|
|
28
|
|
|
|
|
|
|
|
29
|
1452
|
100
|
100
|
|
|
5763
|
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
|
1451
|
|
|
|
|
3260
|
$self->{$key} = $value; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
confess |
43
|
|
|
|
|
|
|
|
44
|
1541
|
50
|
|
|
|
3598
|
"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
|
1541
|
|
|
|
|
7476
|
return $self; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub flatten { |
57
|
|
|
|
|
|
|
|
58
|
1541
|
|
|
1541
|
0
|
2592
|
my ($self) = @_; |
59
|
|
|
|
|
|
|
|
60
|
1541
|
|
|
|
|
3889
|
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
|
|
|
|
|
3
|
return Validation::Class::Mapping->new( |
71
|
|
|
|
|
|
|
Hash::Flatten::unflatten($self->hash) |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |