X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FMeta%2FTypeConstraint%2FDependent.pm;h=ae6ca56f9bafaec769c0ed8e417ddbffc027918c;hb=bcd7eb42f8aa35a7dfc81b2b7e749ee6af32c753;hp=83d140c4c499b7f816cccd37511dc5612b2d0348;hpb=01a1242466a38996ada4ab650121ce73ee277889;p=gitmo%2FMooseX-Dependent.git diff --git a/lib/MooseX/Meta/TypeConstraint/Dependent.pm b/lib/MooseX/Meta/TypeConstraint/Dependent.pm index 83d140c..ae6ca56 100644 --- a/lib/MooseX/Meta/TypeConstraint/Dependent.pm +++ b/lib/MooseX/Meta/TypeConstraint/Dependent.pm @@ -237,6 +237,20 @@ around 'create_child_type' => sub { ); }; +=head2 constraint + +We modify constraint so that the value pass is automatically dereferenced + +=cut + +around 'constraint' => sub { + my ($constraint, $self) = @_; + return sub { + my ($arg) = @_; + $self->$constraint->($arg); + }; +}; + =head2 is_a_type_of =head2 is_subtype_of