Toby Inks' Type::Tiny suite, starting with Types::Standard.
Also see Type::Tiny and Type::Tiny::Manual to define your own constraints, and/or Type::Library to create a type library.#!/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. . .
Hope this helps!
|
|---|