Enumerations in Moose
It's quite a common pattern in object-oriented programming to have an attribute which takes a string as its value, but which only has a small number of valid values. For example:
package Shirt; use Moose; # "S", "M", "L", or "XL" has size => (is => 'ro', isa => 'Str', required => 1);
This offers no protection against invalid string values.
# No exception is thrown my $shirt = Shirt->new(size => "LX");