Basic-Types-XS

 view release on metacpan or  search on metacpan

lib/Basic/Types/XS.pm  view on Meta::CPAN

Sets a coercion function for the type constraint. This function will be used to convert input values before validation.

	Str->coerce(sub {
		my $value = shift;
		return join ",", @{$value} if ref $value eq "ARRAY";
		return $value;
	});

=head2 validate

This method maybe used to set the constaint validation option. What you set here will depend on the type you are using.
For example for the StrMatch type you would set a regex to match against.

	StrMatch->validate(qr/^[a-z]+$/);

=head2 constraint

Returns the validation function for the type constraint. This function can be used to validate values against the type constraint.

	Str->validate->("abc");



( run in 3.293 seconds using v1.01-cache-2.11-cpan-df04353d9ac )