From: John Napiorkowski Date: Mon, 30 Mar 2009 15:55:37 +0000 (+0000) Subject: properly supporting a where clause in the suger example and proof you can customize... X-Git-Tag: 0.01~38 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Dependent.git;a=commitdiff_plain;h=bcd7eb42f8aa35a7dfc81b2b7e749ee6af32c753 properly supporting a where clause in the suger example and proof you can customize with the where clause --- diff --git a/lib/MooseX/Meta/TypeConstraint/Dependent.pm b/lib/MooseX/Meta/TypeConstraint/Dependent.pm index 5219aba..ae6ca56 100644 --- a/lib/MooseX/Meta/TypeConstraint/Dependent.pm +++ b/lib/MooseX/Meta/TypeConstraint/Dependent.pm @@ -241,11 +241,13 @@ around 'create_child_type' => sub { 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); + $self->$constraint->($arg); }; }; diff --git a/t/02-depending.t b/t/02-depending.t index 6b4ac1a..72d799b 100644 --- a/t/02-depending.t +++ b/t/02-depending.t @@ -61,7 +61,7 @@ use Test::More tests=>23; { ok UniqueInt->check([2,[3..6]]), 'PASS unique in set'; ok UniqueInt->check([3,[100..110]]), 'PASS unique in set'; - ## Same as above, with suger + ## Same as above, with sugar subtype UniqueInt2, as depending { my ($dependent_int, $constraining_arrayref) = @_;