Commit | Line | Data |
c5f4b6d4 |
1 | package Email::EzPz::List; |
2 | |
3 | use Module::Runtime qw(use_module); |
4 | use Moo; |
5 | |
6 | with 'Email::EzPz::ListCore'; |
7 | |
e191c67d |
8 | has name => (is => 'lazy'); |
9 | |
10 | sub _build_name { (shift->list_dir =~ m{/([^/]+)$})[0] } |
11 | |
c5f4b6d4 |
12 | sub sublist_type { () } |
13 | |
14 | foreach my $type (qw(allow deny mod digest)) { |
15 | has $type => ( |
16 | is => 'ro', |
17 | lazy => 1, |
18 | default => sub { shift->_build_sublist($type) } |
19 | ); |
20 | } |
21 | |
22 | sub _build_sublist { |
23 | my ($self, $type) = @_; |
24 | return use_module('Email::EzPz::SubList')->new( |
25 | (map +($_ => $self->$_), qw(list_dir ezmlm_bindir)), |
e191c67d |
26 | sublist_type => $type, |
27 | name => $self->name." ${type} list" |
c5f4b6d4 |
28 | ); |
29 | } |
30 | |
31 | 1; |