line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Params::Profile::Params_Check; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
100
|
|
4
|
3
|
|
|
3
|
|
2665
|
use Params::Check; |
|
3
|
|
|
|
|
14226
|
|
|
3
|
|
|
|
|
699
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = $Params::Profile::VERSION; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Params::Profile::Params_Check - Backend module for Params::Profile |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
See C<Params::Profile> |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
C<Params::Check> methods for C<Params::Profile> |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
### params = HASHREF, profiles = ARRAYREF |
23
|
|
|
|
|
|
|
sub validate { |
24
|
0
|
|
|
0
|
0
|
0
|
my ($self, $params, %profile) = @_; |
25
|
0
|
|
|
|
|
0
|
Params::Check::check(\%profile, $params); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _merge_profiles { |
29
|
3
|
|
|
3
|
|
5
|
my ($self, @profiles) = @_; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
### Insert first profile in (tobe) merged_profile |
32
|
3
|
|
|
|
|
6
|
my $merged_profile = shift(@profiles); |
33
|
3
|
|
|
|
|
6
|
foreach my $profile (@profiles) { |
34
|
0
|
|
|
|
|
0
|
foreach my $key (keys %{$profile}) { |
|
0
|
|
|
|
|
0
|
|
35
|
0
|
|
|
|
|
0
|
$merged_profile->{$key} = $profile->{$key}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
3
|
|
|
|
|
22
|
return $merged_profile; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get_profile { |
43
|
3
|
|
|
3
|
0
|
7
|
my ($self, $params, @profiles) = @_; |
44
|
3
|
|
|
|
|
9
|
return $self->_merge_profiles(@profiles); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub check { |
48
|
1
|
|
|
1
|
0
|
4
|
my ($self, $params, %profile) = @_; |
49
|
1
|
|
|
|
|
4
|
Params::Check::check(\%profile, $params); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This module by |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Michiel Ootjers E<lt>michiel@cpan.orgE<gt>. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
and |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Jos Boumans E<lt>kane@cpan.orgE<gt>. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Thanks to Jos Boumans for C<Params::Check>, and the authors of |
69
|
|
|
|
|
|
|
C<Data::FormValidator> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 COPYRIGHT |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This module is |
74
|
|
|
|
|
|
|
copyright (c) 2002 Michiel Ootjers E<lt>michiel@cpan.orgE<gt>. |
75
|
|
|
|
|
|
|
All rights reserved. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This library is free software; |
78
|
|
|
|
|
|
|
you may redistribute and/or modify it under the same |
79
|
|
|
|
|
|
|
terms as Perl itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |