1 package App::EzPz::User;
3 use Module::Runtime qw(use_module);
6 has _htpasswd_user => (
7 is => 'ro', init_arg => 'htpasswd_user', required => 1,
8 handles => [ qw(username password check_password) ],
14 _new_list_object => 'new_list_object'
18 around BUILDARGS => sub {
19 my ($orig, $self) = (shift, shift);
20 my $args = $self->$orig(@_);
21 $args->{htpasswd_user} ||=
22 use_module('Authen::Htpasswd::User')->new(
23 delete @{$args}{qw(username password)}
30 if (my $unsplit = ($self->_htpasswd_user->extra_info||[])->[0]) {
31 return split /\s*,\s*/, $unsplit;
38 my ($self, @names) = @_;
39 my @extra = @{$self->_htpasswd_user->extra_info||[]};
40 $extra[0] = join(', ', @names);
41 $self->_htpasswd_user->extra_info(@extra);
46 my ($self, $name) = @_;
47 my %names; @names{my @names = $self->list_names} = ();
48 return exists $names{$name};
52 my ($self, $name) = @_;
53 unless ($self->has_list_name($name)) {
54 $self->set_list_names($self->list_names, $name);
59 sub remove_list_name {
60 my ($self, $name) = @_;
61 if ($self->has_list_name($name)) {
62 $self->set_list_names(grep !($_ eq $name), $self->list_names)
68 my ($self, $name) = @_;
69 return undef unless $self->has_list_name($name);
70 return $self->_new_list_object({ list_name => $name });