8 my $obj = $class->new(plus_three => 1);
10 is($obj->plus_three, 4, "initial value set (${class})");
14 is($obj->plus_three, 7, 'Value changes after set');
17 sub run_with_default_for {
20 my $obj = $class->new();
22 is($obj->plus_three, 4, "initial value set (${class})");
26 is($obj->plus_three, 7, 'Value changes after set');
38 coerce => sub { $_[0] + 3 }
52 coerce => quote_sub q{
91 die 'could not add three!'
97 like exception { Biff->new(plus_three => 1) }, qr/coercion for "plus_three" failed: could not add three!/, 'Exception properly thrown';
106 default => sub { 1 },
107 coerce => sub { $_[0] + 3 }
111 run_with_default_for 'Foo2';
121 default => sub { 1 },
122 coerce => quote_sub q{
129 run_with_default_for 'Bar2';
139 default => sub { 1 },
150 run_with_default_for 'Baz2';
160 default => sub { 1 },
163 die 'could not add three!'
169 like exception { Biff2->new() }, qr/could not add three!/, 'Exception properly thrown';
178 default => sub { 1 },
179 coerce => sub { $_[0] + 3 },
184 run_with_default_for 'Foo3';
194 default => sub { 1 },
195 coerce => quote_sub(q{
203 run_with_default_for 'Bar3';