use MooseX::Declare; use Method::Signatures::Modifiers; class Article { has 'title' => (is => 'rw', isa => 'Str'); has 'body' => (is => 'rw', isa => 'Str'); has 'keywords' => ( is => 'rw', isa => 'ArrayRef[Str]', lazy => 1, default => sub { [] }, ); method add_keyword (Str $keyword) { return if $keyword ~~ $self->keywords; push @{ $self->keywords }, $keyword; } }