MojoX-Validate-Util
view release on metacpan or search on metacpan
lib/MojoX/Validate/Util.pm view on Meta::CPAN
=back
See also L</check_ascii_digits($params, $topic)> and L</check_number($params, $topic, $expected)>.
=head2 check_key_exists($params, $topic)
Parameters:
=over 4
=item o $params => A hashref
E.g.: $params = {email_address => $value, ...}.
=item o $topic => The name of the parameter being tested
E.g.: $topic = 'email_address'.
=back
Return value: Integer (0 or 1):
=over 4
=item o 0 => Invalid
=item o 1 => Valid
=back
For some non-undef $topic, here are some sample values for $params and the corresponding
return values (using $topic = 'x'):
=over 4
=item o {}: returns 0
=item o {x => undef}: returns 1
=item o {x => ''}: returns 1
=item o {x => '0'}: returns 1
=item o {x => 0}: returns 1
=item o {x => 'yz'}: returns 1
=back
This method uses neither L<Mojolicious::Validator> nor L<Mojolicious::Validator::Validation>.
=head2 check_member($params, $topic, $set)
Parameters:
=over 4
=item o $params => A hashref
E.g.: $params = {love_popup_ads => $value, ...}.
=item o $topic => The name of the parameter being tested
E.g.: $topic = 'love_popup_ads'.
=item o $set => An arrayref of strings
E.g.: ['Yes', B<'No'>].
=back
Return value: Integer (0 or 1) as returned by L<Mojolicious::Validator::Validation#is_valid>.
=over 4
=item o 0 => Invalid
=item o 1 => Valid
=back
=head2 check_number($params, $topic, $expected)
This test uses B<==>. For a test using B<eq>, see L</check_equal_to($params, $topic, $other_topic)>.
Parameters:
=over 4
=item o $params => A hashref
E.g.: $params = {age => $value, ...}.
=item o $topic => The name of the parameter being tested
E.g.: $topic = 'age'.
=item o $expected => An integer
E.g.: 99.
=back
Return value: Integer (0 or 1):
=over 4
=item o 0 => Invalid
=item o 1 => Valid
=back
For some non-undef $topic, $value and $expected, here are some sample values for $value and
$expected, and the corresponding return values:
=over 4
=item o $value == 99 and $expected != 99: returns 0
=item o $value == 99 and $expected == 99: returns 1
=back
( run in 1.106 second using v1.01-cache-2.11-cpan-364913b4093 )