The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Schema::Type::Str - Type handler for string ('str')

VERSION

version 0.136

SYNOPSIS

 use Data::Schema;

DESCRIPTION

This is type handler for 'str'.

TYPE ATTRIBUTES

Strings are Comparable, Sortable, and HasElement, so you might want to consult the docs of those roles to see what type attributes are available.

In addition to these, string has some additional attributes:

match => REGEX

Aliases: matches

Require that the string match a regular expression.

not_match => REGEX

Aliases: not_matches

The opposite of match, require that the string not match a regular expression.

isa_regex => BOOL

If value is true, require that the string be a valid regular expression string. If value is false, require that the string not be a valid regular expression string.

Example:

 ds_validate("(foo|bar)" => [str => {set=>1, isa_regex=>1}); # valid
 ds_validate("(foo|bar"  => [str => {set=>1, isa_regex=>1}); # invalid, unmatched "(" in regex
 ds_validate("(foo|bar"  => [str => {set=>1, isa_regex=>0}); # valid

AUTHOR

  Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2009 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.