19 ::ok(!$@, '... created the reader method okay');
23 reader => 'get_lazy_foo',
28 ::ok(!$@, '... created the lazy reader method okay') or warn $@;
33 local $SIG{__WARN__} = sub { $warn = $_[0] };
38 ::ok($warn, '... got a warning for mispelled attribute argument');
45 can_ok($foo, 'get_foo');
46 is($foo->get_foo(), undef, '... got an undefined value');
49 }, undef, '... get_foo is a read-only' );
51 ok(!exists($foo->{lazy_foo}), '... no value in get_lazy_foo slot');
53 can_ok($foo, 'get_lazy_foo');
54 is($foo->get_lazy_foo(), 10, '... got an deferred value');
56 $foo->get_lazy_foo(100);
57 }, undef, '... get_lazy_foo is a read-only' );
64 my $attr = $foo->meta->find_attribute_by_name("lazy_foo");
66 isa_ok( $attr, "Moose::Meta::Attribute" );
68 ok( $attr->is_lazy, "it's lazy" );
70 is( $attr->get_raw_value($foo), undef, "raw value" );
72 is( $attr->get_value($foo), 10, "lazy value" );
74 is( $attr->get_raw_value($foo), 10, "raw value" );
78 my $foo = Foo->new(foo => 10, lazy_foo => 100);
81 is($foo->get_foo(), 10, '... got the correct value');
82 is($foo->get_lazy_foo(), 100, '... got the correct value');