9 my @params = (is => 'ro', lazy => 1, default => sub { 3 });
11 has one => (@params, predicate => 'has_one', clearer => 'clear_one');
13 has $_ => (@params, clearer => 1, predicate => 1) for qw( bar _bar );
18 for ( qw( one bar _bar ) ) {
19 my ($lead, $middle) = ('_' x /^_/, '_' x !/^_/);
20 my $predicate = $lead . "has$middle$_";
21 my $clearer = $lead . "clear$middle$_";
23 ok(!$foo->$predicate, 'empty');
24 is($foo->$_, 3, 'lazy default');
25 ok($foo->$predicate, 'not empty now');
26 is($foo->$clearer, 3, 'clearer returns value');
27 ok(!$foo->$predicate, 'clearer empties');
28 is($foo->$_, 3, 'default re-fired');
29 ok($foo->$predicate, 'not empty again');