8 my $obj = $class->new(less_than_three => 1);
10 is($obj->less_than_three, 1, 'initial value set');
13 exception { $obj->less_than_three(4) },
14 qr/4 is not less than three/, 'exception thrown on bad set'
17 is($obj->less_than_three, 1, 'initial value remains after bad set');
22 exception { $ret = $obj->less_than_three(2) },
23 undef, 'no exception on correct set'
26 is($ret, 2, 'correct setter return');
27 is($obj->less_than_three, 2, 'correct getter return');
29 is(exception { $class->new }, undef, 'no exception with no value');
31 exception { $class->new(less_than_three => 12) },
32 qr/12 is not less than three/, 'exception thrown on bad constructor arg'
41 has less_than_three => (
43 isa => sub { die "$_[0] is not less than three" unless $_[0] < 3 }
55 has less_than_three => (
57 isa => quote_sub q{ die "$_[0] is not less than three" unless $_[0] < 3 }
69 has less_than_three => (
72 q{ die "$_[0] is not less than ${word}" unless $_[0] < $limit },
73 { '$limit' => \3, '$word' => \'three' }