8 my $obj = $class->new(less_than_three => 1);
10 is($obj->less_than_three, 1, "initial value set (${class})");
13 exception { $obj->less_than_three(4) },
14 qr/isa check for "less_than_three" failed: 4 is not less than three/,
15 "exception thrown on bad set (${class})"
18 is($obj->less_than_three, 1, "initial value remains after bad set (${class})");
23 exception { $ret = $obj->less_than_three(2) },
24 undef, "no exception on correct set (${class})"
27 is($ret, 2, "correct setter return (${class})");
28 is($obj->less_than_three, 2, "correct getter return (${class})");
30 is(exception { $class->new }, undef, "no exception with no value (${class})");
32 exception { $class->new(less_than_three => 12) },
33 qr/isa check for "less_than_three" failed: 12 is not less than three/,
34 "exception thrown on bad constructor arg (${class})"
43 has less_than_three => (
45 isa => sub { die "$_[0] is not less than three" unless $_[0] < 3 }
57 has less_than_three => (
61 die "$x is not less than three" unless $x < 3
74 has less_than_three => (
79 die "$value is not less than ${word}" unless $value < $limit
81 { '$limit' => \3, '$word' => \'three' }
96 has less_than_three => (
98 isa => quote_sub(q{ die "$_[0] is not less than three" unless $_[0] < 3 })
101 sub _build_less_than_three { $lt3 }
107 exception { LazyFoo->new->less_than_three },
108 qr/isa check for "less_than_three" failed: 4 is not less than three/,
109 "exception thrown on bad builder return value (LazyFoo)"
114 is(LazyFoo->new->less_than_three, 2, 'Correct builder value returned ok');