package Data::Object::Library; use 5.014; use strict; use warnings; use base 'Type::Library'; use Scalar::Util (); use Type::Coercion (); use Type::Tiny (); use Type::Utils (); use Types::TypeTiny (); our $VERSION = '1.88'; # VERSION Type::Utils::extends('Types::Standard'); Type::Utils::extends('Types::TypeTiny'); Type::Utils::extends('Types::Common::Numeric'); Type::Utils::extends('Types::Common::String'); # TYPES RegisterAll(DoArgs()); RegisterAll(DoData()); RegisterAll(DoDumpable()); RegisterAll(DoArray()); RegisterAll(DoBoolean()); RegisterAll(DoCli()); RegisterAll(DoCode()); RegisterAll(DoException()); RegisterAll(DoFloat()); RegisterAll(DoFunc()); RegisterAll(DoHash()); RegisterAll(DoImmutable()); RegisterAll(DoNumber()); RegisterAll(DoOpts()); RegisterAll(DoRegexp()); RegisterAll(DoReplace()); RegisterAll(DoScalar()); RegisterAll(DoSearch()); RegisterAll(DoSpace()); RegisterAll(DoStashable()); RegisterAll(DoState()); RegisterAll(DoString()); RegisterAll(DoStruct()); RegisterAll(DoThrowable()); RegisterAll(DoUndef()); RegisterAll(DoVars()); # FUNCTIONS sub DoArgs { { name => 'DoArgs', aliases => [ 'ArgsObj', 'ArgsObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Args'); return 1; }, parent => 'Object' } } sub DoArray { { name => 'DoArray', aliases => [ 'ArrayObj', 'ArrayObject' ], coercions => [ 'ArrayRef', sub { require Data::Object::Array; Data::Object::Array->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Array'); return 1; }, explaination => sub { my ($data, $type, $name) = @_; my $param = $type->parameters->[0]; for my $i (0 .. $#$data) { next if $param->check($data->[$i]); my $indx = sprintf('%s->[%d]', $name, $i); my $desc = $param->validate_explain($data->[$i], $indx); my $text = '"%s" constrains each value in the array object with "%s"'; return [sprintf($text, $type, $param), @{$desc}]; } return; }, parameterize_constraint => sub { my ($data, $type) = @_; $type->check($_) || return for @$data; return !!1; }, parameterize_coercions => sub { my ($data, $type, $anon) = @_; my $coercions = []; push @$coercions, 'ArrayRef', sub { my $value = @_ ? $_[0] : $_; my $items = []; for (my $i = 0; $i < @$value; $i++) { return $value unless $anon->check($value->[$i]); $items->[$i] = $data->coerce($value->[$i]); } return $type->coerce($items); }; return $coercions; }, parent => 'Object' } } sub DoBoolean { { name => 'DoBoolean', aliases => [ 'BoolObj', 'BoolObject', 'BooleanObj', 'BooleanObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Boolean'); return 1; }, parent => 'Object' } } sub DoCli { { name => 'DoCli', aliases => [ 'CliObj', 'CliObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Cli'); return 1; }, parent => 'Object' } } sub DoCode { { name => 'DoCode', aliases => [ 'CodeObj', 'CodeObject' ], coercions => [ 'CodeRef', sub { require Data::Object::Code; Data::Object::Code->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Code'); return 1; }, parent => 'Object' } } sub DoData { { name => 'DoData', aliases => [ 'DataObj', 'DataObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Data'); return 1; }, parent => 'Object' } } sub DoDumpable { { name => 'DoDumpable', aliases => [ 'Dumpable' ], validation => sub { return 0 if !$_[0]->does('Data::Object::Role::Dumpable'); return 1; }, parent => 'Object' } } sub DoException { { name => 'DoException', aliases => [ 'ExceptionObj', 'ExceptionObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Exception'); return 1; }, parent => 'Object' } } sub DoFloat { { name => 'DoFloat', aliases => [ 'FloatObj', 'FloatObject' ], coercions => [ 'Str', sub { require Data::Object::Float; Data::Oject::Float->new($_[0]); }, 'Num', sub { require Data::Object::Float; Data::Oject::Float->new($_[0]); }, 'LaxNum', sub { require Data::Object::Float; Data::Oject::Float->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Float'); return 1; }, parent => 'Object' } } sub DoFunc { { name => 'DoFunc', aliases => [ 'FuncObj', 'FuncObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Func'); return 1; }, parent => 'Object' } } sub DoHash { { name => 'DoHash', aliases => [ 'HashObj', 'HashObject' ], coercions => [ 'HashRef', sub { require Data::Object::Hash; Data::Object::Hash->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Hash'); return 1; }, explaination => sub { my ($data, $type, $name) = @_; my $param = $type->parameters->[0]; for my $k (sort keys %$data) { next if $param->check($data->{$k}); my $indx = sprintf('%s->{%s}', $name, B::perlstring($k)); my $desc = $param->validate_explain($data->{$k}, $indx); my $text = '"%s" constrains each value in the hash object with "%s"'; return [sprintf($text, $type, $param), @{$desc}]; } return; }, parameterize_constraint => sub { my ($data, $type) = @_; $type->check($_) || return for values %$data; return !!1; }, parameterize_coercions => sub { my ($data, $type, $anon) = @_; my $coercions = []; push @$coercions, 'HashRef', sub { my $value = @_ ? $_[0] : $_; my $items = {}; for my $k (sort keys %$value) { return $value unless $anon->check($value->{$k}); $items->{$k} = $data->coerce($value->{$k}); } return $type->coerce($items); }; return $coercions; }, parent => 'Object' } } sub DoImmutable { { name => 'DoImmutable', aliases => [ 'Immutable' ], validation => sub { return 0 if !$_[0]->does('Data::Object::Role::Immutable'); return 1; }, parent => 'Object' } } sub DoNumber { { name => 'DoNum', aliases => [ 'NumObj', 'NumObject', 'NumberObj', 'NumberObject' ], coercions => [ 'Int', sub { require Data::Object::Number; Data::Object::Number->new($_[0]); }, 'Num', sub { require Data::Object::Number; Data::Object::Number->new($_[0]); }, 'LaxNum', sub { require Data::Object::Number; Data::Object::Number->new($_[0]); }, 'StrictNum', sub { require Data::Object::Number; Data::Object::Number->new($_[0]); }, 'Str', sub { require Data::Object::Number; Data::Object::Number->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Number'); return 1; }, parent => 'Object' } } sub DoOpts { { name => 'DoOpts', aliases => [ 'OptsObj', 'OptsObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Opts'); return 1; }, parent => 'Object' } } sub DoRegexp { { name => 'DoRegexp', aliases => [ 'RegexpObj', 'RegexpObject' ], coercions => [ 'RegexpRef', sub { require Data::Object::Regexp; Data::Object::Regexp->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Regexp'); return 1; }, parent => 'Object' } } sub DoReplace { { name => 'DoReplace', aliases => [ 'ReplaceObj', 'ReplaceObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Replace'); return 1; }, parent => 'Object' } } sub DoScalar { { name => 'DoScalar', aliases => [ 'ScalarObj', 'ScalarObject' ], coercions => [ 'ScalarRef', sub { require Data::Object::Scalar; Data::Object::Scalar->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Scalar'); return 1; }, parent => 'Object' } } sub DoSearch { { name => 'DoSearch', aliases => [ 'SearchObj', 'SearchObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Search'); return 1; }, parent => 'Object' } } sub DoSpace { { name => 'DoSpace', aliases => [ 'SpaceObj', 'SpaceObject' ], coercions => [ 'Str', sub { require Data::Object::Space; Data::Object::Space->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Space'); return 1; }, parent => 'Object' } } sub DoStashable { { name => 'DoStashable', aliases => [ 'Stashable' ], validation => sub { return 0 if !$_[0]->does('Data::Object::Role::Stashable'); return 1; }, parent => 'Object' } } sub DoState { { name => 'DoState', aliases => [ 'StateObj', 'StateObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::State'); return 1; }, parent => 'Object' } } sub DoString { { name => 'DoStr', aliases => [ 'StrObj', 'StrObject', 'StringObj', 'StringObject' ], coercions => [ 'Str', sub { require Data::Object::String; Data::Object::String->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::String'); return 1; }, parent => 'Object' } } sub DoStruct { { name => 'DoStruct', aliases => [ 'StructObj', 'StructObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Struct'); return 1; }, parent => 'Object' } } sub DoThrowable { { name => 'DoThrowable', aliases => [ 'Throwable' ], validation => sub { return 0 if !$_[0]->does('Data::Object::Role::Throwable'); return 1; }, parent => 'Object' } } sub DoUndef { { name => 'DoUndef', aliases => [ 'UndefObj', 'UndefObject' ], coercions => [ 'Undef', sub { require Data::Object::Undef; Data::Object::Undef->new($_[0]); } ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Undef'); return 1; }, parent => 'Object' } } sub DoVars { { name => 'DoVars', aliases => [ 'VarsObj', 'VarsObject' ], validation => sub { return 0 if !$_[0]->isa('Data::Object::Vars'); return 1; }, parent => 'Object' } } sub Library { __PACKAGE__->meta; } sub Register { my ($type) = @_; my $library = Library(); my $name = $type->{name}; my $aliases = $type->{aliases}; my $parent = $type->{parent}; my $coercions = $type->{coercions}; my $validation = $type->{validation}; return if $library->get_type($name); my $tinytype = Type::Tiny->new(Options($type)); if ($type->{coercions}) { my $coercions = $type->{coercions}; for (my $i = 0; $i < @$coercions; $i+=2) { if (!ref($coercions->[$i])) { $coercions->[$i] = $library->get_type($coercions->[$i]); } } $tinytype->coercion->add_type_coercions(@$coercions); } $library->add_type($tinytype); return $tinytype; } sub Options { my ($type) = @_; my $library = Library(); my %options; $options{name} = $type->{name}; $options{parent} = $type->{parent}; $options{constraint} = sub { $type->{validation}->(@_) }; if ($type->{explaination}) { $options{deep_explanation} = sub { GenerateExplanation($type, @_) }; } if ($type->{parameterize_coercions}) { $options{coercion_generator} = sub { GenerateCoercion($type, @_) }; } if ($type->{parameterize_constraint}) { $options{constraint_generator} = sub { GenerateConstraint($type, @_) }; } if (!ref($options{parent})) { $options{parent} = $library->get_type($options{parent}); } return %options; } sub RegisterAll { my ($type) = @_; my $registered = Register($type); Register({%{$type}, name => $_, aliases => []}) for @{$type->{aliases}}; return $registered; } sub GenerateCoercion { my ($type, @args) = @_; my ($type1, $xtype, $type2) = @args; my $library = Library(); if (!$type2->has_coercion) { return $type1->coercion; } my $anon = $type2->coercion->_source_type_union; my $coercion = Type::Coercion->new(type_constraint => $xtype); my $generated = $type->{parameterize_coercions}->($type2, $type1, $anon); for (my $i = 0; $i < @$generated; $i+=2) { my $item = $generated->[$i]; $generated->[$i] = $library->get_type($item) if !ref($item); } $coercion->add_type_coercions(@$generated); return $coercion; } sub GenerateConstraint { my ($type, @args) = @_; return $type->{validator} if !@args; my $sign = "@{[$type->{name}]}\[`a\]"; my $text = "Parameter to $sign expected to be a type constraint"; my @list = map Types::TypeTiny::to_TypeTiny($_), @args; for my $item (@list) { if ($item->isa('Type::Tiny')) { next; } if (!Types::TypeTiny::TypeTiny->check($item)) { Types::Standard::_croak("$text; got $item"); } } return sub { my ($data) = @_; $type->{parameterize_constraint}->($data, @list) }; } sub GenerateExplanation { my ($type, @args) = @_; return $type->{explaination}->($_[2], $_[1], $_[3]); } # ONE-OFFS Type::Utils::declare('RegexpLike', Type::Utils::as(Object(), Type::Utils::where(sub { return !!re::is_regexp($_[0]) || (Scalar::Util::blessed($_[0]) && ($_[0]->isa('Regexp') || $_[0]->isa('Data::Object::Regexp'))); }))); Type::Utils::declare('NumberLike', Type::Utils::as(StringLike(), Type::Utils::where(sub { return Scalar::Util::looks_like_number("$_[0]"); }))); 1; =encoding utf8 =head1 NAME Data::Object::Library =cut =head1 ABSTRACT Data-Object Type Library =cut =head1 SYNOPSIS use Data::Object::Library; =cut =head1 DESCRIPTION This package provides a core type library for the L framework. =cut =head1 INHERITANCE This package inherits behaviors from: L L L L =cut =head1 FUNCTIONS This package implements the following functions. =cut =head2 doargs DoArgs() : HashRef This function returns the type configuration for a L object. =over 4 =item DoArgs example Data::Object::Library::DoArgs(); =back =cut =head2 doarray DoArray() : HashRef This function returns the type configuration for a L object. =over 4 =item DoArray example Data::Object::Library::DoArray(); =back =cut =head2 doboolean DoBoolean() : HashRef This function returns the type configuration for a L object. =over 4 =item DoBoolean example Data::Object::Library::DoBoolean(); =back =cut =head2 docli DoCli() : HashRef This function returns the type configuration for a L object. =over 4 =item DoCli example Data::Object::Library::DoCli(); =back =cut =head2 docode DoCode() : HashRef This function returns the type configuration for a L object. =over 4 =item DoCode example Data::Object::Library::DoCode(); =back =cut =head2 dodata DoData() : HashRef This function returns the type configuration for a L object. =over 4 =item DoData example Data::Object::Library::DoData(); =back =cut =head2 dodumpable DoDumpable() : HashRef This function returns the type configuration for an object with the L role. =over 4 =item DoDumpable example Data::Object::Library::DoDumpable(); =back =cut =head2 doexception DoException() : HashRef This function returns the type configuration for a L object. =over 4 =item DoException example Data::Object::Library::DoException(); =back =cut =head2 dofloat DoFloat() : HashRef This function returns the type configuration for a L object. =over 4 =item DoFloat example Data::Object::Library::DoFloat(); =back =cut =head2 dofunc DoFunc() : HashRef This function returns the type configuration for a L object. =over 4 =item DoFunc example Data::Object::Library::DoFunc(); =back =cut =head2 dohash DoHash() : HashRef This function returns the type configuration for a L object. =over 4 =item DoHash example Data::Object::Library::DoHash(); =back =cut =head2 doimmutable DoImmutable() : HashRef This function returns the type configuration for an object with the L role. =over 4 =item DoImmutable example Data::Object::Library::DoImmutable(); =back =cut =head2 donumber DoNumber() : HashRef This function returns the type configuration for a L object. =over 4 =item DoNumber example Data::Object::Library::DoNumber(); =back =cut =head2 doopts DoOpts() : HashRef This function returns the type configuration for a L object. =over 4 =item DoOpts example Data::Object::Library::DoOpts(); =back =cut =head2 doregexp DoRegexp() : HashRef This function returns the type configuration for a L object. =over 4 =item DoRegexp example Data::Object::Library::DoRegexp(); =back =cut =head2 doreplace DoReplace() : HashRef This function returns the type configuration for a L object. =over 4 =item DoReplace example Data::Object::Library::DoReplace(); =back =cut =head2 doscalar DoScalar() : HashRef This function returns the type configuration for a L object. =over 4 =item DoScalar example Data::Object::Library::DoScalar(); =back =cut =head2 dosearch DoSearch() : HashRef This function returns the type configuration for a L object. =over 4 =item DoSearch example Data::Object::Library::DoSearch(); =back =cut =head2 dospace DoSpace() : HashRef This function returns the type configuration for a L object. =over 4 =item DoSpace example Data::Object::Library::DoSpace(); =back =cut =head2 dostashable DoStashable() : HashRef This function returns the type configuration for an object with the L role. =over 4 =item DoStashable example Data::Object::Library::DoStashable(); =back =cut =head2 dostate DoState() : HashRef This function returns the type configuration for a L object. =over 4 =item DoState example Data::Object::Library::DoState(); =back =cut =head2 dostring DoString() : HashRef This function returns the type configuration for a L object. =over 4 =item DoString example Data::Object::Library::DoString(); =back =cut =head2 dostruct DoStruct() : HashRef This function returns the type configuration for a L object. =over 4 =item DoStruct example Data::Object::Library::DoStruct(); =back =cut =head2 dothrowable DoThrowable() : HashRef This function returns the type configuration for an object with the L role. =over 4 =item DoThrowable example Data::Object::Library::DoThrowable(); =back =cut =head2 doundef DoUndef() : HashRef This function returns the type configuration for a L object. =over 4 =item DoUndef example Data::Object::Library::DoUndef(); =back =cut =head2 dovars DoVars() : HashRef This function returns the type configuration for a L object. =over 4 =item DoVars example Data::Object::Library::DoVars(); =back =cut =head2 generatecoercion GenerateCoercion(HashRef $config) : InstanceOf["Type::Coercion"] This function takes a type configuration hashref, then generates and returns a type coercion based on its configuration. =over 4 =item GenerateCoercion example Data::Object::Library::GenerateCoercion({...}); =back =cut =head2 generateconstraint GenerateConstraint(HashRef $config) : CodeRef This function takes a type configuration hashref, then generates and returns a coderef which validates the type based on its configuration. =over 4 =item GenerateConstraint example Data::Object::Library::GenerateConstraint({...}); =back =cut =head2 generateexplanation GenerateExplanation(HashRef $config) : CodeRef This function takes a type configuration hashref, then generates and returns a coderef which returns a deep-explanation of the type failure based on its configuration. =over 4 =item GenerateExplanation example Data::Object::Library::GenerateExplanation({...}); =back =cut =head2 library Library() : InstanceOf["Type::Library"] This function returns the core type library object. =over 4 =item Library example Data::Object::Library::Library(); =back =cut =head2 options Options(HashRef $config) : (Any) This function takes a type configuration hashref, then generates and returns a set of options relevant to creating L objects. =over 4 =item Options example Data::Object::Library::Options({...}); =back =cut =head2 register Register(HashRef $config) : InstanceOf["Type::Tiny"] This function takes a type configuration hashref, then generates and returns a L object based on its configuration. =over 4 =item Register example Data::Object::Library::Register({...}); =back =cut =head2 registerall RegisterAll(HashRef $config) : InstanceOf["Type::Tiny"] This function takes a type configuration hashref, then generates and returns a L object based on its configuration. This method also registers aliases as stand-alone types in the library. =over 4 =item RegisterAll example Data::Object::Library::RegisterAll({...}); =back =cut =head1 CONSTRAINTS This package provides the following type constraints. =head2 any # Any The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception is the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 arraylike # ArrayLike The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 argsobj # ArgsObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 argsobject # ArgsObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 arrayobj # ArrayObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 arrayobject # ArrayObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 arrayref # ArrayRef The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 bool # Bool The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 boolobj # BoolObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 boolobject # BoolObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 booleanobj # BooleanObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 booleanobject # BooleanObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 classname # ClassName["MyClass"] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 codelike # CodeLike The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 cliobj # CliObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 cliobject # CliObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 codeobj # CodeObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 codeobject # CodeObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 coderef # CodeRef The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 consumerof # ConsumerOf["MyRole"] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 dataobj # DataObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 dataobject # DataObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 defined # Defined The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 dict # Dict The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 dumpable # Dumpable The C type constraint is provided by this library and accepts any object that is a consumer of the L role. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 enum # Enum[qw(A B C)] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 exceptionobj # ExceptionObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 exceptionobject # ExceptionObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 filehandle # FileHandle The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 floatobj # FloatObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 floatobject # FloatObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 funcobj # FuncObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 funcobject # FuncObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 globref # GlobRef The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 hasmethods # HasMethods["new"] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 hashlike # HashLike The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 hashobj # HashObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 hashobject # HashObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 hashref # HashRef The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 immutable # Immutable The C type constraint is provided by this library and accepts any object that is a consumer of the L role. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 instanceof # InstanceOf[MyClass] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 int # Int The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 intobj # IntObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 intobject # IntObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 intrange # IntRange[0, 25] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 integerobj # IntegerObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 integerobject # IntegerObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 item # Item The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 laxnum # LaxNum The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 lowercasesimplestr # LowerCaseSimpleStr The C type constraint is provided by the L library. Please see that documentation for more The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. information. =head2 lowercasestr # LowerCaseStr The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 map # Map[Int, HashRef] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 maybe # Maybe[Object] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 negativeint # NegativeInt The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 negativenum # NegativeNum The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 negativeorzeroint # NegativeOrZeroInt The C type constraint is provided by the L library. Please see that documentation for more The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. information. =head2 negativeorzeronum # NegativeOrZeroNum The C type constraint is provided by the L library. Please see that documentation for more The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. information. =head2 nonemptysimplestr # NonEmptySimpleStr The C type constraint is provided by the L library. Please see that documentation for more The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. information. =head2 nonemptystr # NonEmptyStr The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 num # Num The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 numberlike # NumberLike The C type constraint is provided by the this library and accepts any value that looks like a number, or object that overloads stringification and looks like a number stringified. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 numobj # NumObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 numobject # NumObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 numrange # NumRange[0, 25] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 numberobject # NumberObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 numericcode # NumericCode The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 object # Object The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 optsobj # OptsObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 optsobject # OptsObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 optlist # OptList The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 optional # Dict[id => Optional[Int]] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 overload # Overload[qw("")] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 password # Password The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 positiveint # PositiveInt The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 positivenum # PositiveNum The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 positiveorzeroint # PositiveOrZeroInt The C type constraint is provided by the L library. Please see that documentation for more The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. information. =head2 positiveorzeronum # PositiveOrZeroNum The C type constraint is provided by the L library. Please see that documentation for more The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. information. =head2 ref # Ref["SCALAR"] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 regexpobj # RegexpObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 regexpobject # RegexpObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 regexpref # RegexpRef The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 replaceobj # ReplaceObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 replaceobject # ReplaceObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 rolename # RoleName The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 scalarobj # ScalarObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 scalarobject # ScalarObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 scalarref # ScalarRef The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 searchobj # SearchObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 searchobject # SearchObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 simplestr # SimpleStr The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 singledigit # SingleDigit The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 spaceobj # SpaceObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 spaceobject # SpaceObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 stashable # Stashable The C type constraint is provided by this library and accepts any object that is a consumer of the L role. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 stateobj # StateObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 stateobject # StateObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 str # Str The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 strmatch # StrMatch[qr/^[A-Z]+$/] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 strobj # StrObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 strobject # StrObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 strictnum # StrictNum The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 stringlike # StringLike The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 stringobj # StringObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 stringobject # StringObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 strongpassword # StrongPassword The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 structobj # StructObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 structobject # StructObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 throwable # Throwable The C type constraint is provided by this library and accepts any object that is a consumer of the L role. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 tied # Tied["MyClass"] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 tuple # Tuple[Int, Str, Str] The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 typetiny # TypeTiny The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 undef # Undef The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 undefobj # UndefObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 undefobject # UndefObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 uppercasesimplestr # UpperCaseSimpleStr The C type constraint is provided by the L library. Please see that documentation for more The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. information. =head2 uppercasestr # UpperCaseStr The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 value # Value The C type constraint is provided by the L library. Please see that documentation for more information. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 varsobj # VarsObj The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head2 varsobject # VarsObject The C type constraint is provided by this library and accepts any object that is, or is derived from, a L object. The C function can be used to throw an exception if the argument can not be validated. The C function can be used to return true or false if the argument can not be validated. =head1 CREDITS Al Newkirk, C<+319> Anthony Brummett, C<+10> Adam Hopkins, C<+2> José Joaquín Atria, C<+1> =cut =head1 AUTHOR Al Newkirk, C =head1 LICENSE Copyright (C) 2011-2019, Al Newkirk, et al. This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated here, https://github.com/iamalnewkirk/do/blob/master/LICENSE. =head1 PROJECT L L L L L L =head1 SEE ALSO To get the most out of this distribution, consider reading the following: L L L L L L L =cut