6 my $lazy_default = "lazy_default";
13 has rwp => (is => 'rwp');
14 has lazy => (is => 'lazy');
15 sub _build_lazy { $test }
16 has lazy_default => (is => 'lazy', default => sub { $lazy_default });
23 is $foo->rwp, undef, "rwp value starts out undefined";
24 ok exception { $foo->rwp($test) }, "rwp is read_only";
25 is exception { $foo->_set_rwp($test) }, undef, "rwp can be set by writer";
26 is $foo->rwp, $test, "rwp value was set by writer";
31 is $foo->{lazy}, undef, "lazy value storage is undefined";
32 is $foo->lazy, $test, "lazy value returns test value when called";
33 ok exception { $foo->lazy($test) }, "lazy is read_only";
38 is $foo->{lazy_default}, undef, "lazy_default value storage is undefined";
39 is $foo->lazy_default, $lazy_default, "lazy_default value returns test value when called";
40 ok exception { $foo->lazy_default($test) }, "lazy_default is read_only";