From 98b6d1ba27fa2a2e1434e1fecd3479a2b4903fe7 Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 16 Mar 2017 17:45:56 +0000 Subject: Dzil-build release 1.0.0 (from 9f1fc6d on master) --- lib/Sietima/Role/ManualSubscription.pm | 62 ++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 17 deletions(-) (limited to 'lib/Sietima/Role/ManualSubscription.pm') diff --git a/lib/Sietima/Role/ManualSubscription.pm b/lib/Sietima/Role/ManualSubscription.pm index fd75f80..1023fa3 100644 --- a/lib/Sietima/Role/ManualSubscription.pm +++ b/lib/Sietima/Role/ManualSubscription.pm @@ -4,11 +4,44 @@ use Sietima::Policy; use URI; use namespace::clean; -# VERSION +our $VERSION = '1.0.0'; # VERSION # ABSTRACT: adds standard list-related headers to messages with 'Sietima::Role::WithOwner'; + +around list_addresses => sub($orig,$self) { + my $list_name = $self->name // 'the list'; + my $mail_owner_uri = URI->new($self->owner,'mailto'); + my $sub_uri = $mail_owner_uri->clone; + $sub_uri->query_form(subject => "Please add me to $list_name"); + my $unsub_uri = $mail_owner_uri->clone; + $unsub_uri->query_form(subject => "Please remove me from $list_name"); + + return +{ + $self->$orig->%*, + subscribe => $sub_uri, + unsubscribe => $unsub_uri, + }; +}; + + +1; + +__END__ + +=pod + +=encoding UTF-8 + +=head1 NAME + +Sietima::Role::ManualSubscription - adds standard list-related headers to messages + +=head1 VERSION + +version 1.0.0 + =head1 SYNOPSIS my $sietima = Sietima->with_traits( @@ -26,28 +59,23 @@ 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 +=head1 MODIFIED METHODS + +=head2 C This method declares two "addresses", C and C. Both are C URLs for the list L, with different subjects. -=cut +=head1 AUTHOR -around list_addresses => sub($orig,$self) { - my $list_name = $self->name // 'the list'; - my $mail_owner_uri = URI->new($self->owner,'mailto'); - my $sub_uri = $mail_owner_uri->clone; - $sub_uri->query_form(subject => "Please add me to $list_name"); - my $unsub_uri = $mail_owner_uri->clone; - $unsub_uri->query_form(subject => "Please remove me from $list_name"); +Gianni Ceccarelli - return +{ - $self->$orig->%*, - subscribe => $sub_uri, - unsubscribe => $unsub_uri, - }; -}; +=head1 COPYRIGHT AND LICENSE +This software is copyright (c) 2017 by Gianni Ceccarelli . -1; +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut -- cgit v1.2.3