X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FApp-EzPz.git;a=blobdiff_plain;f=lib%2FApp%2FEzPz%2FUser.pm;fp=lib%2FApp%2FEzPz%2FUser.pm;h=770fc3629b3f9b40bf0d1cbb6c7b0fc661eccbcf;hp=a4da2f1195c11af17561d5a281752560f55fd9c5;hb=fda55d3e18008b847db5b383dc94e3fde8dcdf1e;hpb=bdab61a3b862017e4b56e242212b55a4e574be79 diff --git a/lib/App/EzPz/User.pm b/lib/App/EzPz/User.pm index a4da2f1..770fc36 100644 --- a/lib/App/EzPz/User.pm +++ b/lib/App/EzPz/User.pm @@ -8,7 +8,12 @@ has _htpasswd_user => ( handles => [ qw(username password check_password) ], ); -has ezmlm_bindir => (is => 'rwp'); +has ezmlm_config => ( + is => 'rwp', + handles => { + _new_list_object => 'new_list_object' + } +); around BUILDARGS => sub { my ($orig, $self) = (shift, shift); @@ -37,20 +42,32 @@ sub set_list_names { return; } -sub add_list_name { +sub has_list_name { my ($self, $name) = @_; my %names; @names{my @names = $self->list_names} = (); - $self->set_list_names(@names, $name) unless exists $names{$name}; + return exists $names{$name}; +} + +sub add_list_name { + my ($self, $name) = @_; + unless ($self->has_list_name($name)) { + $self->set_list_names($self->list_names, $name); + } return $name; } sub remove_list_name { my ($self, $name) = @_; - my %names; @names{my @names = $self->list_names} = (); - if (exists $names{$name}) { + if ($self->has_list_name($name)) { $self->set_list_names(grep !($_ eq $name), $self->list_names) } return $name; } +sub get_list { + my ($self, $name) = @_; + return undef unless $self->has_list_name($name); + return $self->_new_list_object({ list_name => $name }); +} + 1;