initial sketch of classes
[scpubgit/App-EzPz.git] / lib / Email / EzPz / List.pm
diff --git a/lib/Email/EzPz/List.pm b/lib/Email/EzPz/List.pm
new file mode 100644 (file)
index 0000000..1b60894
--- /dev/null
@@ -0,0 +1,26 @@
+package Email::EzPz::List;
+
+use Module::Runtime qw(use_module);
+use Moo;
+
+with 'Email::EzPz::ListCore';
+
+sub sublist_type { () }
+
+foreach my $type (qw(allow deny mod digest)) {
+  has $type => (
+    is => 'ro',
+    lazy => 1,
+    default => sub { shift->_build_sublist($type) }
+  );
+}
+
+sub _build_sublist {
+  my ($self, $type) = @_;
+  return use_module('Email::EzPz::SubList')->new(
+    (map +($_ => $self->$_), qw(list_dir ezmlm_bindir)),
+    sublist_type => $type
+  );
+}
+
+1;