Params::Validate::Checks::Integer - Params::Validate checks for functions taking integer arguments
version 0.01
use Params::Validate::Checks qw<validate as>; use Params::Validate::Checks::Integer; sub league_table_row { my %arg = validate @_, { position => { as 'pos_int' }, #From P::V::Checks games_played => { as 'non-neg-int' }, points => { as 'integer' }, #Allow for points deducted! goal_difference => { as 'integer' }, }; # Do something with this league table position. }
This is a library of named checks for use with Params::Validate to validate all integers and those that should be non-negative. See Params::Validate::Checks for in-built validation of positive (non-zero) integers.
The following named checks are supplied by this module.
integer
an integer value, which can be positive, negative or zero.
non-neg-int
an integer value, which can be positive or zero.
Params::Validate::Checks::Integer - Params::Validate checks for functions taking integer arguments.
Params::Validate::Checks, the framework this is using
Scalar::Util::Numeric, provider of the isint() check.
Smylers <smylers@cpan.org> for Params::Validate::Checks.
chocolateboy <chocolate@cpan.org> for Scalar::Util::Numeric
Stephen Cardie <stephenca@cpan.org>
This software is Copyright (c) 2011 by Stephen Cardie.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Params::Validate::Checks::Integer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Params::Validate::Checks::Integer
CPAN shell
perl -MCPAN -e shell install Params::Validate::Checks::Integer
For more information on module installation, please visit the detailed CPAN module installation guide.