blob: 181e0c2a2261727c42ad794d53f2b4d0b4ac4866 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
use strict;
use warnings;
use Test::More;
{
package Foo;
use Moose;
eval {
has 'foo' => (
is => "rw",
init_arg => undef,
);
};
::ok(!$@, '... created the attr okay');
}
{
my $foo = Foo->new( foo => "bar" );
isa_ok($foo, 'Foo');
is( $foo->foo, undef, "field is not set via init arg" );
$foo->foo("blah");
is( $foo->foo, "blah", "field is set via setter" );
}
done_testing;
|