[Moose-commits] r7875 - in MooseX-Types-Dependent/trunk:
lib/MooseX/Meta/TypeConstraint t
jnapiorkowski at code2.0beta.co.uk
jnapiorkowski at code2.0beta.co.uk
Mon Mar 30 16:55:38 BST 2009
Author: jnapiorkowski
Date: 2009-03-30 08:55:37 -0700 (Mon, 30 Mar 2009)
New Revision: 7875
Modified:
MooseX-Types-Dependent/trunk/lib/MooseX/Meta/TypeConstraint/Dependent.pm
MooseX-Types-Dependent/trunk/t/02-depending.t
Log:
properly supporting a where clause in the suger example and proof you can customize with the where clause
Modified: MooseX-Types-Dependent/trunk/lib/MooseX/Meta/TypeConstraint/Dependent.pm
===================================================================
--- MooseX-Types-Dependent/trunk/lib/MooseX/Meta/TypeConstraint/Dependent.pm 2009-03-30 15:53:45 UTC (rev 7874)
+++ MooseX-Types-Dependent/trunk/lib/MooseX/Meta/TypeConstraint/Dependent.pm 2009-03-30 15:55:37 UTC (rev 7875)
@@ -241,11 +241,13 @@
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);
};
};
Modified: MooseX-Types-Dependent/trunk/t/02-depending.t
===================================================================
--- MooseX-Types-Dependent/trunk/t/02-depending.t 2009-03-30 15:53:45 UTC (rev 7874)
+++ MooseX-Types-Dependent/trunk/t/02-depending.t 2009-03-30 15:55:37 UTC (rev 7875)
@@ -61,7 +61,7 @@
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) = @_;
More information about the Moose-commits
mailing list