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

NAME

Simo::Constrain - Constrain functions for Simo;

VERSION

Version 0.0201

Simo::Constrain is experimental stage. some function will be change.

SYNOPSIS

    This class provede many functions intended to use with constrain option.
    
    package Book;
    use Simo;
    use Simo::Constrain qw( is_str isa is_int );
    
    sub title{ ac constrain => sub{ is_str } };
    sub author{ ac constrain => sub{ isa 'Person' } }
    sub price{ ac constrain => sub{ is_int } }

EXPORT

No function is exported.

All function can be exported.

    use Simo::Constrain qw( isa is_object is_int is_str );

FUNCTIONS

The following is constrain functions.

If function return false, error message is set to $@.

If first argument is omitted, all functions receive $_ as first argument.

is_undef

If it is undef, return true.

is_defined

If it is defined, return true.

is_bool

If it is boolean, return true.

( undef, "", 0, and 1 ) are boolean.

is_value

If it is value, return true.

Not reference value is value.

is_str

If it is string, return true.

Not reference value is string. This is same as value.

is_num

If it is number, return true.

If Scalar::Util::looks_like_number return true, it is number.

is_int

If it is integer, return true.

If regexp /^-?[0-9]+$/ is matched. it is integer.

is_ref

If it is reference, return true.

is_scalar_ref

If it is scalar reference, return true.

is_array_ref

If it is array reference, return true.

is_hash_ref

If it is hash reference, return true.

is_code_ref

If it is code reference, return true.

is_regexp_ref

If it is regular expression reference, return true.

is_glob_ref

If it is glob reference, return true.

is_file_handle

If it is file handle, return true.

If Scalar::Util::openhandle is true, it is file handle.

is_object

If it is objcet, return true.

Blessed value is object, except qr//.

is_class_name

If it is class name, return true.

If /^(\w+::)*\w+$/ is matched, it is class name.

blessed

If it is blessed, return true.

isa

If it inherit a Class, return true.

    sub author{ ac constrain => sub{ isa 'Person' }, }

AUTHOR

Yuki Kimoto, <kimoto.yuki at gmail.com>

BUGS

Please report any bugs or feature requests to bug-simo-constrain at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Simo-Constrain. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Simo::Constrain

You can also look for information at:

See also

I study from Moose::Util::TypeConstraints and Most of Simo::Constrain functions is compatible of Moose::Util::TypeConstraints

Moose,Moose::Util::TypeConstraints

Scalar::Util is used in Simo::Constrain

Scalar::Util

COPYRIGHT & LICENSE

Copyright 2009 Yuki, all rights reserved.

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