File Coverage

blib/lib/Sietima/Role/WithPostAddress.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 21 21 100.0


line stmt bran cond sub pod time code
1             package Sietima::Role::WithPostAddress;
2 2     2   1107 use Moo::Role;
  2         5  
  2         13  
3 2     2   660 use Sietima::Policy;
  2         5  
  2         12  
4 2     2   14 use Sietima::Types qw(Address AddressFromStr);
  2         4  
  2         14  
5 2     2   896 use namespace::clean;
  2         6  
  2         11  
6              
7             our $VERSION = '1.0.4'; # VERSION
8             # ABSTRACT: role for lists with a posting address
9              
10              
11             has post_address => (
12             is => 'lazy',
13             isa => Address,
14             coerce => AddressFromStr,
15             );
16 3     3   80 sub _build_post_address($self) { $self->return_path }
  3         7  
  3         6  
  3         61  
17              
18             around list_addresses => sub($orig,$self) {
19             return +{
20             $self->$orig->%*,
21             post => $self->post_address,
22             };
23             };
24              
25             1;
26              
27             __END__
28              
29             =pod
30              
31             =encoding UTF-8
32              
33             =head1 NAME
34              
35             Sietima::Role::WithPostAddress - role for lists with a posting address
36              
37             =head1 VERSION
38              
39             version 1.0.4
40              
41             =head1 SYNOPSIS
42              
43             my $sietima = Sietima->with_traits('WithPostAddress')->new({
44             %args,
45             return_path => 'list-bounce@example.com',
46             post_address => 'list@example.com',
47             });
48              
49             =head1 DESCRIPTION
50              
51             This role adds an L<< /C<post_address> >> attribute, and exposes it
52             via the L<< C<list_addresses>|Sietima/list_addresses >> method.
53              
54             On its own, this role is not very useful, but other roles (like L<<
55             C<ReplyTo>|Sietima::Role::ReplyTo >>) can have uses for a post
56             address.
57              
58             =head1 ATTRIBUTES
59              
60             =head2 C<post_address>
61              
62             An L<< C<Email::Address> >> object, defaults to the value of the L<<
63             C<return_path>|Sietima/return_path >> attribute. This is the address
64             that the mailing list receives messages at.
65              
66             =head1 AUTHOR
67              
68             Gianni Ceccarelli <dakkar@thenautilus.net>
69              
70             =head1 COPYRIGHT AND LICENSE
71              
72             This software is copyright (c) 2017 by Gianni Ceccarelli <dakkar@thenautilus.net>.
73              
74             This is free software; you can redistribute it and/or modify it under
75             the same terms as the Perl 5 programming language system itself.
76              
77             =cut