NAME
Object::Simple::Constraint - Constraint functions for Object::Simple;
VERSION
Version 0.01_01
Object::Simple::Constraint is experimental stage. some function will be change.
SYNOPSIS
This class provede many constraint function
use Object::Simple::Constraint qw( is_str isa is_int );
is_str( 'aaa' );
isa( $obj, 'Some::Class' );
is_int( 4 );
EXPORT
No function is exported.
All function can be exported.
use Object::Simple::Constraint qw( isa is_object is_int is_str );
FUNCTIONS
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.
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=Object::Simple-Constraint. 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 Object::Simple::Constraint
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Object::Simple-Constraint
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
See also
I study from Moose::Util::TypeConstraints and Most of Object::Simple::Constrain functions is compatible of Moose::Util::TypeConstraints
Moose,Moose::Util::TypeConstraints
Scalar::Util is used in Object::Simple::Constrain
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.