Moose::Meta::TypeConstraint.3pm

Langue: en

Version: 2008-12-08 (ubuntu - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Moose::Meta::TypeConstraint - The Moose Type Constraint metaclass

DESCRIPTION

For the most part, the only time you will ever encounter an instance of this class is if you are doing some serious deep introspection. This API should not be considered final, but it is highly unlikely that this will matter to a regular Moose user.

If you wish to use features at this depth, please come to the #moose IRC channel on irc.perl.org and we can talk :)

METHODS

meta
new
equals ($type_name_or_object)
This checks the current type against the supplied type (only). Returns false if the two types are not equal. It also returns false if you provide the type as a name, and the type name isn't found in the type registry.
is_a_type_of ($type_name_or_object)
This checks the current type against the supplied type, or if the current type is a sub-type of the type name or object supplied. It also returns false if you provide the type as a name, and the type name isn't found in the type registry.
is_subtype_of ($type_name_or_object)
This checks the current type is a sub-type of the type name or object supplied. It also returns false if you provide the type as a name, and the type name isn't found in the type registry.
compile_type_constraint
coerce ($value)
This will apply the type-coercion if applicable.
check ($value)
This method will return a true (1) if the $value passes the constraint, and false (0) otherwise.
validate ($value)
This method is similar to "check", but it deals with the error message. If the $value passes the constraint, "undef" will be returned. If the $value does not pass the constraint, then the "message" will be used to construct a custom error message.
name
The name of the type in the global type registry.
parent
This type's parent type.
has_parent
Returns true if this type has a parent type.
parents
constraint
has_message
message
get_message ($value)
has_coercion
coercion
hand_optimized_type_constraint
has_hand_optimized_type_constraint
create_child_type

DEPRECATED METHOD

union
This was just bad idea on my part,.. use the Moose::Meta::TypeConstraint::Union itself instead.

BUGS

All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.

AUTHOR

Stevan Little <stevan@iinteractive.com> Copyright 2006-2008 by Infinity Interactive, Inc.

<http://www.iinteractive.com>

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