16 |
our @EXPORT = qw( |
our @EXPORT = qw( |
17 |
); |
); |
18 |
|
|
19 |
our $VERSION = '0.5'; |
our $VERSION = '0.6'; |
20 |
|
|
21 |
use Class::DBI::Loader; |
use Class::DBI::Loader; |
22 |
use Email::Valid; |
use Email::Valid; |
122 |
|
|
123 |
=head2 new_list |
=head2 new_list |
124 |
|
|
125 |
Create new list. Required arguments are name of C<list> and |
Create new list. Required arguments are name of C<list>, C<email> address |
126 |
C<email> address. |
and path to C<aliases> file. |
127 |
|
|
128 |
$nos->new_list( |
$nos->new_list( |
129 |
list => 'My list', |
list => 'My list', |
130 |
from => 'Outgoing from comment', |
from => 'Outgoing from comment', |
131 |
email => 'my-list@example.com', |
email => 'my-list@example.com', |
132 |
|
aliases => '/etc/mail/mylist', |
133 |
|
archive => '/path/to/mbox/archive', |
134 |
); |
); |
135 |
|
|
136 |
Returns ID of newly created list. |
Returns ID of newly created list. |
723 |
warn "aliases file $aliases doesn't exist, creating empty\n"; |
warn "aliases file $aliases doesn't exist, creating empty\n"; |
724 |
open(my $fh, '>', $aliases) || croak "can't create $aliases: $!"; |
open(my $fh, '>', $aliases) || croak "can't create $aliases: $!"; |
725 |
close($fh); |
close($fh); |
726 |
|
chmod 0777, $aliases || warn "can't change permission to 0777"; |
727 |
} |
} |
728 |
|
|
729 |
my $a = new Mail::Alias($aliases) || croak "can't open aliases file $aliases: $!"; |
my $a = new Mail::Alias($aliases) || croak "can't open aliases file $aliases: $!"; |
903 |
sub NewList { |
sub NewList { |
904 |
my $self = shift; |
my $self = shift; |
905 |
|
|
906 |
my $aliases = $self->{'aliases'} || croak "Nos::SOAP need 'aliases' argument to new constructor"; |
croak "self is not Nos::SOAP object" unless (ref($self) eq 'Nos::SOAP'); |
907 |
|
|
908 |
|
my $aliases = $self->{'aliases'} || croak "need 'aliases' argument to new constructor"; |
909 |
|
|
910 |
if ($_[0] !~ m/^HASH/) { |
if ($_[0] !~ m/^HASH/) { |
911 |
return $nos->new_list( |
return $nos->new_list( |