11 my $obj = $class->new;
13 ok(!@tr, "${class}: trigger not fired with no value");
15 $obj = $class->new(one => 1);
17 is_deeply(\@tr, [ 1 ], "${class}: trigger fired on new");
19 my $res = $obj->one(2);
21 is_deeply(\@tr, [ 1, 2 ], "${class}: trigger fired on set");
23 is($res, 2, "${class}: return from set ok");
25 is($obj->one, 2, "${class}: return from accessor ok");
27 is_deeply(\@tr, [ 1, 2 ], "${class}: trigger not fired for accessor as get");
35 has one => (is => 'rw', trigger => sub { push @::tr, $_[1] });
46 has one => (is => 'rw', trigger => quote_sub q{ push @::tr, $_[1] });
59 trigger => quote_sub(q{ push @{$tr}, $_[1] }, { '$tr' => \\@::tr })