Commit | Line | Data |
---|---|---|
6cff6b7a | 1 | #!/usr/bin/perl |
2 | use strict; | |
3 | use Test::More; | |
3823fbc7 | 4 | #warn $Mouse::VERSION; |
6cff6b7a | 5 | { |
6 | package Foo; | |
7 | ||
8 | use Mouse; | |
9 | ||
10 | has thing => ( | |
11 | reader => 'thing', | |
12 | writer => 'set_thing', | |
13 | builder => '_build_thing', | |
14 | lazy => 1, | |
15 | ); | |
16 | ||
17 | sub _build_thing { | |
18 | 42; | |
19 | } | |
20 | } | |
21 | ||
22 | # Get them set | |
23 | { | |
24 | my $obj = Foo->new; | |
25 | is $obj->thing, 42; | |
26 | $obj->set_thing( 23 ); | |
27 | is $obj->thing, 23; | |
28 | } | |
29 | ||
30 | # Set then get | |
31 | { | |
32 | my $obj = Foo->new; | |
33 | $obj->set_thing(23); | |
34 | is $obj->thing, 23; | |
35 | } | |
36 | ||
37 | done_testing(); |