X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FDependent%2FMeta%2FTypeConstraint%2FDependent.pm;h=6b6a962bd62d506f51d12fefd173a8fc53c7b378;hb=21df4517825e6c4bc201683264ecf7a3b8e25230;hp=12003dc22c899b85f3e49dd7a22503b4f6d9aa2a;hpb=5ae5d765a87ca6108bc3a081d41df513867837bf;p=gitmo%2FMooseX-Dependent.git diff --git a/lib/MooseX/Dependent/Meta/TypeConstraint/Dependent.pm b/lib/MooseX/Dependent/Meta/TypeConstraint/Dependent.pm index 12003dc..6b6a962 100644 --- a/lib/MooseX/Dependent/Meta/TypeConstraint/Dependent.pm +++ b/lib/MooseX/Dependent/Meta/TypeConstraint/Dependent.pm @@ -3,6 +3,7 @@ package ## Hide from PAUSE use Moose; use Moose::Util::TypeConstraints (); +use MooseX::Dependent::Meta::TypeCoercion::Dependent; use Scalar::Util qw(blessed); use Data::Dump; use Digest::MD5; @@ -70,6 +71,20 @@ has 'constraining_value' => ( This class defines the following methods. +=head2 BUILD + +Do some post build stuff + +=cut + +sub BUILD { + my ($self) = @_; + $self->coercion( + MooseX::Dependent::Meta::TypeCoercion::Dependent->new( + type_constraint => $self, + )); +} + =head2 parameterize (@args) Given a ref of type constraints, create a structured type. @@ -173,6 +188,8 @@ sub parameterize { parent_type_constraint=>$self->parent_type_constraint, constraining_value_type_constraint => $self->constraining_value_type_constraint, ); + + ## TODO This is probably going to have to go away (too many things added to the registry) Moose::Util::TypeConstraints::get_type_constraint_registry->add_type_constraint($type_constraint); return $type_constraint; }