The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MooseX::Meta::TypeConstraint::Parameterizable - Metaclass for Parameterizable type constraints.

DESCRIPTION

see MooseX::Parameterizable::Types for how to use parameterizable types. This class is a subclass of Moose::Meta::TypeConstraint which provides the gut functionality to enable parameterizable type constraints.

This class is not intended for public consumption. Please don't subclass it or rely on it. Chances are high stuff here is going to change a lot. For example, I will probably refactor this into several classes to get rid of all the ugly conditionals.

ATTRIBUTES

This class defines the following attributes.

parent_type_constraint

The type constraint whose validity is being made parameterizable.

constraining_value_type_constraint

This is a type constraint which defines what kind of value is allowed to be the constraining value of the parameterizable type.

constraining_value

This is the actual value that constraints the "parent_type_constraint"

METHODS

This class defines the following methods.

BUILD

Do some post build stuff

parameterize (@args)

Given a ref of type constraints, create a structured type.

_generate_subtype_name

Returns a name for the parameterizable type that should be unique

create_child_type

modifier to make sure we get the constraint_generator

equals ($type_constraint)

Override the base class behavior so that a parameterizable type equal both the parent type and the overall parameterizable container. This behavior may change if we can figure out what a parameterizable type is (multiply inheritance or a role...)

is_subtype_of

Method modifier to make sure we match on subtype for both the parameterizable type as well as the type being made parameterizable

check

As with 'is_subtype_of', we need to dual dispatch the method request

validate

As with 'is_subtype_of', we need to dual dispatch the method request

_compiled_type_constraint

modify this method so that we pass along the constraining value to the constraint coderef and also throw the correct error message if the constraining value does not match it's requirement.

coerce

More method modification to support dispatch coerce to a parent.

get_message

Give you a better peek into what's causing the error.

around 'get_message' => sub { my ($get_message, $self, $value) = @_; return $self->$get_message($value); };

SEE ALSO

The following modules or resources may be of interest.

Moose, Moose::Meta::TypeConstraint

AUTHOR

John Napiorkowski, <jjnapiork@cpan.org>

COPYRIGHT & LICENSE

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