use Moose;
use Moose::Util::TypeConstraints;
use Declare::Constraints::Simple -All;
-
+
# define your own type ...
- type 'HashOfArrayOfObjects'
- => IsHashRef(
+ type( 'HashOfArrayOfObjects',
+ {
+ where => IsHashRef(
-keys => HasLength,
- -values => IsArrayRef( IsObject ));
-
+ -values => IsArrayRef(IsObject)
+ )
+ } );
+
has 'bar' => (
is => 'rw',
isa => 'HashOfArrayOfObjects',
# inline the constraints as anon-subtypes
has 'baz' => (
is => 'rw',
- isa => subtype('ArrayRef' => IsArrayRef(IsInt)),
+ isa => subtype( { as => 'ArrayRef', where => IsArrayRef(IsInt) } ),
);
package Bar;