Moose Type Constraints
Since I last wrote have been working a lot improving the MooseX::Types library system and cleaning up some related issues in Moose, as well as developing the new MooseX::Types::Structured type constraint library. First off, MooseX::Types now properly supports parameterized types, so you can:
subtype ArrayRefOfInts,
as ArrayRef[Int];
and it will work as expected. Recursive types let's you create something like:
subtype Tree,
as ArrayRef[Branch];subtype Branch,
as ArrayRef[Branch|Leaf];
Which basically means "A Tree is an array reference of one or more Branch(es) and each Branch is an array reference to more Branch(es) or Leaves". Notice the '|' overloading to support the Union 'Or' type constraint.
I know this is just a taste, more details to come later. Until then you'll have to make do with the linked documentation and associated test examples.
Happy New Year!