Commit | Line | Data |
---|---|---|
32381de9 | 1 | use strictures 1; |
2 | use Test::More; | |
3 | ||
4 | { | |
5 | package Foo; | |
6 | ||
7 | use Moo; | |
8 | ||
9 | has one => (is => 'ro', weak_ref => 1); | |
10 | } | |
11 | ||
12 | my $ref = \'yay'; | |
13 | ||
14 | my $foo = Foo->new(one => $ref); | |
15 | ||
16 | is(${$foo->one},'yay', 'value present'); | |
17 | ok(Scalar::Util::isweak($foo->{one}), 'value weakened'); | |
18 | ||
19 | done_testing; |