Type::Tiny, Specio, MooseX::Types, and MouseX::Types do actually all support a common core set of methods.
For example, if $type is a type constraint object of any of the above, the following will work for all four of them:
# Type checksdie($type->get_message($value))unless$type->check($value);# Type coercionsif($type->has_coercion){$value=$type->coerce($orig);}# Inliningif($type->can('can_be_inlined')and$type->can_be_inlined){my$method=$type->can('inline_check')||$type->can('_inline_check');my$varname='$foo';say$type->$method($varname);}
It's not just a co-incidence that they all support this API: they're all aiming for (almost) drop-in compatibility with Moose::Meta::TypeConstraint.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Type::Tiny, Specio, MooseX::Types, and MouseX::Types do actually all support a common core set of methods.
For example, if
$type
is a type constraint object of any of the above, the following will work for all four of them:It's not just a co-incidence that they all support this API: they're all aiming for (almost) drop-in compatibility with Moose::Meta::TypeConstraint.