
Simo::Constrain - Constrain functions for Simo [DISCOURAGED]

This module is discouraged now, because I develope new module Object::Simple now.
Object::Simple is very simple class builder. It is clean, compact, and fast.

Version 0.0302

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 } }

No function is exported.
All function can be exported.
use Simo::Constrain qw( isa is_object is_int is_str );

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.
If it is undef, return true.
If it is defined, return true.
If it is boolean, return true.
( undef, "", 0, and 1 ) are boolean.
If it is value, return true.
Not reference value is value.
If it is string, return true.
Not reference value is string. This is same as value.
If it is number, return true.
If Scalar::Util::looks_like_number return true, it is number.
If it is integer, return true.
If regexp /^-?[0-9]+$/ is matched. it is integer.
If it is reference, return true.
If it is scalar reference, return true.
If it is array reference, return true.
If it is hash reference, return true.
If it is code reference, return true.
If it is regular expression reference, return true.
If it is glob reference, return true.
If it is file handle, return true.
If Scalar::Util::openhandle is true, it is file handle.
If it is objcet, return true.
Blessed value is object, except qr//.
If it is class name, return true.
If /^(\w+::)*\w+$/ is matched, it is class name.
If it is blessed, return true.
If it inherit a Class, return true.
sub author{ ac constrain => sub{ isa 'Person' }, }

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

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.

You can find documentation for this module with the perldoc command.
perldoc Simo::Constrain
You can also look for information at:

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

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.