Handel::Constraints - Common database constraints used to validate input data
use Handel::Constraints qw/constraint_quantity/; my $qty = 'bogus-1'; if (constraint_quantity($qty)) { print 'invalid quantity'; };
Handel::Constraints contains a set of functions used to validate data submitted by users into Handel objects. By default, Handel::Constraints doesn't export anything. Use the export tags to export groups of functions, or specify the exact methods you are interested in using. See Exporter for more information on using export tags.
Returns 1 if the value passed is a numeric, non-negative value that is less than or equal HandelMaxQuantity. Otherwise it returns undef.
undef
See Handel::ConfigReader for more information on HandelMaxQuantity and HandelMaxQuantityAction.
Returns 1 if the value passed is a numeric, non-negative value between 0 and 99999.99, otherwise it returns undef.
Returns 1 if the value passed is conforms to the GUID/UUID format, otherwise it returns undef. Currently, this does not expect the brackets around the value.
constraint_uuid( '11111111-1111-1111-1111-111111111111' ); # 1 constraint_uuid('{11111111-1111-1111-1111-111111111111}'); # undef
This will probably change in the future, or some sort of stripping of the brackets may occur.
Returns 1 if the value passed is CART_TYPE_SAVED or CART_TYPE_TEMP, otherwise it returns undef.
CART_TYPE_SAVED
CART_TYPE_TEMP
Returns 1 if the value passed is considered a 3 letter currency code. If Locale::Currency is installed, it will verify the 3 letter code is actually a valid currency code.
If Locale::Currency is not installed, it simply checks that the code conforms to:
/^[A-Z]{3}$/
Returns 1 if the value passed is one of the CHECKOUT_PHASE_* constants, otherwise it returns undef.
CHECKOUT_PHASE_*
Returns 1 if the value passed is ORDER_TYPE_SAVED or ORDER_TYPE_TEMP, otherwise it returns undef.
ORDER_TYPE_SAVED
ORDER_TYPE_TEMP
Returns 0 if the cart type is CART_TYPE_SAVED and the name is undefined, otherwise it returns 1.
Exports all functions into the callers namespace.
use Handel::Constraints qw/:all/;
Christopher H. Laco CPAN ID: CLACO claco@chrislaco.com http://today.icantfocus.com/blog/
To install Handel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Handel
CPAN shell
perl -MCPAN -e shell install Handel
For more information on module installation, please visit the detailed CPAN module installation guide.