4 use Moose::Util::TypeConstraints;
6 subtype 'DigitSix' => as 'Num'
8 subtype 'TextSix' => as 'Str'
12 => via { confess("Cannot live without 6 ($_)") unless /^6$/; 'Six' };
14 has foo => ( isa => 'TextSix', coerce => 1, is => 'ro', default => 6,
19 use Test::More tests => 2;
20 my $attr = SomeClass->meta->get_attribute('foo');
21 is($attr->get_value(SomeClass->new()), 'Six');
22 is(SomeClass->new()->foo, 'Six');