package Sietima::Role::ManualSubscription; use Moo::Role; use Sietima::Policy; use Sietima::HeaderURI; use namespace::clean; # VERSION # ABSTRACT: adds standard list-related headers to messages with 'Sietima::Role::WithOwner'; =head1 SYNOPSIS my $sietima = Sietima->with_traits( 'Headers', 'ManualSubscription', )->new({ %args, owner => 'listmaster@example.com', }); =head1 DESCRIPTION A L<< C >> list with this role (and L<< C|Sietima::Role::Headers >>) applied will add, to each outgoing message, headers specifying that to subscribe and unsubscribe, people sould email the list owner. =modif C This method declares two "addresses", C and C. Both are C URLs for the list L, with different subjects. =cut around list_addresses => sub($orig,$self) { my $list_name = $self->name // 'the list'; return +{ $self->$orig->%*, subscribe => Sietima::HeaderURI->new_from_address( $self->owner, { subject => "Please add me to $list_name" }, ), unsubscribe => Sietima::HeaderURI->new_from_address( $self->owner, { subject => "Please remove me from $list_name" }, ), }; }; 1;