NAME
Handel::Constraints - Common database constraints used to validate input data
VERSION
$Id: Constraints.pm 274 2005-03-02 02:22:05Z claco $
SYNOPSIS
use Handel::Constraints qw(constraint_quantity);
my $qty = 'bogus-1';
if (constraint_quantity($qty) {
print 'invalid quantity';
};
DESCRIPTION
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.
FUNCTIONS
constraint_quantity
Returns 1 if the value passed is a numeric, non-negative value, otherwise it returns undef
.
constraint_price
Returns 1 if the value passed is a numeric, non-negative value between 0 and 99999.99, otherwise it returns undef
.
constraint_uuid
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.
constraint_cart_type
Returns 1 if the value passed is CART_TYPE_SAVED
or CART_TYPE_TEMP
, otherwise it returns undef
.
EXPORT_TAGS
:all
Exports all functions into the classes namespace.
use Handel::Constraints qw(:all);
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
cpan@chrislaco.com
http://today.icantfocus.com/blog/