more pod and clarified license
[gitmo/MooseX-Dependent.git] / lib / MooseX / Dependent / Meta / TypeCoercion / Dependent.pm
index 5640267..65cedef 100644 (file)
@@ -10,21 +10,22 @@ MooseX::Meta::TypeCoercion::Dependent - Coerce Dependent type constraints.
 
 =head1 DESCRIPTION
 
-TBD
+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.
 
 =head1 METHODS
 
 This class defines the following methods.
 
-=head
+=head add_type_coercions
 
-=cut
+method modification to throw exception should we try to add a coercion on a
+dependent type that is already defined by a constraining value.  We do this
+since defined dependent type constraints inherit their coercion from the parent
+constraint.  It makes no sense to even be using dependent types if you know the
+constraining value beforehand!
 
-sub coerce {
-    my $self = shift @_;
-    my $coderef = $self->_compiled_type_coercion;
-    return $coderef->(@_);
-}
+=cut
 
 around 'add_type_coercions' => sub {
     my ($add_type_coercions, $self, @args) = @_;
@@ -35,6 +36,15 @@ around 'add_type_coercions' => sub {
     }
 };
 
+
+## These two are here until I can merge change upstream to Moose.  These are two
+## very minor changes we can probably just put into Moose without breaking stuff
+sub coerce {
+    my $self = shift @_;
+    my $coderef = $self->_compiled_type_coercion;
+    return $coderef->(@_);
+}
+
 sub compile_type_coercion {
     my $self = shift;
     my @coercion_map = @{$self->type_coercion_map};
@@ -66,9 +76,6 @@ sub compile_type_coercion {
     });
 }
 
-
-
-
 =head1 SEE ALSO
 
 The following modules or resources may be of interest.