aboutsummaryrefslogtreecommitdiff
path: root/lib/Sietima/Role/WithMailStore.pm
blob: 7ca4b4ec9626fa155f536f9c8384d69a14eb7001 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package Sietima::Role::WithMailStore; 
use Moo::Role;
use Sietima::Policy;
use Sietima::Types qw(MailStore MailStoreFromHashRef);
use namespace::clean;
 
# VERSION 
# ABSTRACT: role for lists with a store for messages 
 
=head1 SYNOPSIS
 
  my $sietima = Sietima->with_traits('WithMailStore')->new({
    %args,
    mail_store => {
      class => 'Sietima::MailStore::FS',
      root => '/tmp',
    },
  });
 
=head1 DESCRIPTION
 
This role adds a L<< /C<mail_store> >> attribute.
 
On its own, this role is not very useful, but other roles (like L<<
C<SubscriberOnly::Moderate>|Sietima::Role::SubscriberOnly::Moderate
>>) can have uses for an object that can persistently store messages.
 
=attr C<mail_store>
 
Required instance of an object that consumes the L<<
C<Sietima::MailStore> >> role. Instead of passing an instance, you can
pass a hashref (like in the L</synopsis>): the C<class> key provides
the class name, and the rest of the hash will be passed to its
constructor.
 
=cut
 
has mail_store => (
    is => 'ro',
    isa => MailStore,
    required => 1,
    coerce => MailStoreFromHashRef,
);
 
1;