NAME

Declare::Constraints::Simple::Library::Operators - Operators

SYNOPSIS

# all hast to be valid
my $and_constraint = And( IsInt,
                          Matches(qr/0$/) );

# at least one has to be valid
my $or_constraint = Or( IsInt, HasLength );

# only one can be valid
my $xor_constraint = XOr( IsClass, IsObject );

# reverse validity
my $not_an_integer = Not( IsInt );

DESCRIPTION

This module contains the frameworks operators. These constraint like elements act on the validity of passed constraints.

OPERATORS

And(@constraints)

Is true if all passed @constraints are true on the value. Returns the result of the first failing constraint.

Or(@constraints)

Is true if at least one of the passed @contraints is true. Returns the last failing constraint's result if false.

XOr(@constraints)

Valid only if a single one of the passed @constraints is valid. Returns the last failing constraint's result if false.

Not($constraint)

This is valid if the passed $constraint is false. The main purpose of this operator is to allow the easy reversion of a constraint's trueness.

SEE ALSO

Declare::Constraints::Simple, Declare::Constraints::Simple::Library

AUTHOR

Robert 'phaylon' Sedlacek <phaylon@dunkelheit.at>

LICENSE AND COPYRIGHT

This module is free software, you can redistribute it and/or modify it under the same terms as perl itself.