Skip to content

Instantly share code, notes, and snippets.

@jjn1056
Created June 30, 2010 20:44
Show Gist options
  • Save jjn1056/459195 to your computer and use it in GitHub Desktop.
Save jjn1056/459195 to your computer and use it in GitHub Desktop.
my $deep_tuple = subtype 'deep_tuple',
as Tuple[
Int,
HashRef,
Dict[
name=>Str,
age=>Int,
],
];
warn $deep_tuple->validate([1,{a=>2},{name=>'Vincent1',age=>'Hello1'}]);
## Error message is now:
Validation failed for 'deep_tuple' with value [ 1, { a: 2 }, { age: "Hello1", name: "Vincent1" } ], Internal Validation Error is: Validation failed for 'MooseX::Types::Structured::Dict[name,Str,age,Int]' with value { age: "Hello1", name: "Vincent1" }, Internal Validation Error is: Validation failed for 'Int' with value Hello1 at t/12-error.t line 130.
ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment