package Sietima::Role::WithOwner; use Moo::Role; use Sietima::Policy; use Sietima::Types qw(Address AddressFromStr); use namespace::clean; # VERSION # ABSTRACT: role for lists with an owner =head1 SYNOPSIS my $sietima = Sietima->with_traits('WithOwner')->new({ %args, owner => 'listmaster@example.com', }); =head1 DESCRIPTION This role adds an L<< /C >> attribute, and exposes it via the L<< C|Sietima/list_addresses >> method. On its own, this role is not very useful, but other roles (like L<< C|Sietima::Role::SubscriberOnly::Moderate >>) can have uses for an owner address. =attr C Required instance of L<< C >>, coercible from a string. This is the address of the owner of the list. =cut has owner => ( is => 'ro', isa => Address, required => 1, coerce => AddressFromStr, ); =modif C This method declares the C address. =cut around list_addresses => sub($orig,$self) { return +{ $self->$orig->%*, owner => $self->owner, }; }; 1;