| 1 | package Params::Profile::Params_Check; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use Params::Check; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | 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 | ▶ | my ($self, $params, %profile) = @_; |
|
Subroutine
validate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 25 | 0 | Params::Check::check(\%profile, $params); | |
| 26 | } | ||
| 27 | |||
| 28 | sub _merge_profiles { | ||
| 29 | 3 | ▶ | my ($self, @profiles) = @_; |
|
Subroutine
_merge_profiles: called CC=3 SCAR=13.1
| |||
| 30 | |||
| 31 | ### Insert first profile in (tobe) merged_profile | ||
| 32 | 3 | my $merged_profile = shift(@profiles); | |
| 33 | 3 | foreach my $profile (@profiles) { | |
| 34 | 0 | foreach my $key (keys %{$profile}) { | |
| 35 | 0 | $merged_profile->{$key} = $profile->{$key}; | |
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | 3 | return $merged_profile; | |
| 40 | } | ||
| 41 | |||
| 42 | sub get_profile { | ||
| 43 | 3 | ▶ | my ($self, $params, @profiles) = @_; |
|
Subroutine
get_profile: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 44 | 3 | return $self->_merge_profiles(@profiles); | |
| 45 | } | ||
| 46 | |||
| 47 | sub check { | ||
| 48 | 1 | ▶ | my ($self, $params, %profile) = @_; |
|
Subroutine
check: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 49 | 1 | Params::Check::check(\%profile, $params); | |
| 50 | } | ||
| 51 | |||
| 52 | 3 | 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 | ||