NAME
Data::Transpose::Validator::Base - Base class for Data::Transpose::Validator
SYNOPSIS
my $v = Data::Transpose::Validator::Base->new;
ok($v->is_valid("string"), "A string is valid");
ok($v->is_valid([]), "Empty array is valid");
ok($v->is_valid({}), "Empty hash is valid");
ok(!$v->is_valid(undef), "undef is not valid");
METHODS (to be overwritten by the subclasses)
new()
Constructor. It accepts an hash with the options.
is_valid($what)
Main method. Return true if the variable passed is defined, false if it's undefined, storing an error.
error
Main method to check why the validator returned false. When an argument is provided, set the error.
In scalar context it returns a human-readable string with the errors.
In list context it returns the raw error list, where each element is a pair of code and strings.
reset_errors
Clear the errors stored.
error_codes
Returns the list of the error codes for the current validation.