Data::Sah::Type::Sortable - Specification for sortable types
version 0.02
This is the Sortable role. It provides clauses like 'lt' ("less than"), 'gt' ("greater than"), and so on. It is used by many types, for example 'str', all numeric types, etc.
Role consumer must provide method 'superclause_sortable' which will receive the same %args as clause methods, but with additional key: -which (either 'min', 'max', 'xmin', 'xmax').
Unless specified otherwise, all clauses have a priority of 50 (normal).
Require that the value is not less than some specified minimum (equivalent in intention to the Perl string 'ge' operator, or the numeric >= operator).
Example:
[int => {min => 0}] # specify positive numbers
Require that the value is not less nor equal than some specified minimum (equivalent in intention to the Perl string 'gt' operator, or the numeric > operator). The "x" prefix is for "exclusive".
Require that the value is less or equal than some specified maximum (equivalent in intention to the Perl string 'le' operator, or the numeric <= operator).
Require that the value is less than some specified maximum (equivalent in intention to the Perl string 'lt' operator, or the numeric < operator). The "x" prefix is for "exclusive".
A convenient clause to combine min and max.
Example, the following schemas are equivalent:
[float => {between => [0.0, 1.5]}] [float => {min => 0.0, max => 1.5}]
A convenient clause to combine xmin and xmax.
Steven Haryanto <stevenharyanto@gmail.com>
This software is copyright (c) 2012 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::Sah, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Sah
CPAN shell
perl -MCPAN -e shell install Data::Sah
For more information on module installation, please visit the detailed CPAN module installation guide.