in reply to Params::Validate, MooseX::Params::Validate, Method::Signatures, MooseX::Method::Signatrues or your own solutions

Toby Inks' Type::Tiny suite, starting with Types::Standard.

#!/usr/bin/perl use strict; use warnings; use Moo; # Or Moose, or Mouse use Types::Standard qw/ :all /; has foo => ( is => 'ro', isa => Str, required => 1 ); has bar => ( is => 'ro', isa => HashRef, required => 1 ); has flintstone => ( is => 'ro', isa => Enum[qw( Fred Wilma Pebbles Bam +Bam )] ); # etc. . .
Also see Type::Tiny and Type::Tiny::Manual to define your own constraints, and/or Type::Library to create a type library.

Hope this helps!

The way forward always starts with a minimal test.
  • Comment on Re: Params::Validate, MooseX::Params::Validate, Method::Signatures, MooseX::Method::Signatrues or your own solutions
  • Download Code