--- trunk/sender.pl 2005/08/02 18:28:57 69 +++ trunk/sender.pl 2005/08/22 20:24:04 72 @@ -2,7 +2,7 @@ use strict; use blib; -use Nos; +use Nos 0.7; use Getopt::Long; =head1 NAME @@ -11,7 +11,8 @@ =head1 SYNOPSYS - sender.pl --new=mylist + sender.pl --create=mylist + sender.pl --drop=mylist sender.pl --add=mylist members.txt sender.pl --delete=mylist members.txt sender.pl --list[=mylist] @@ -33,7 +34,8 @@ my $opt; my $result = GetOptions( - "new=s" => \$opt->{'new'}, + "create=s" => \$opt->{'create'}, + "drop=s" => \$opt->{'drop'}, "list:s" => \$opt->{'list'}, "add=s" => \$opt->{'add'}, "delete=s" => \$opt->{'delete'}, @@ -74,29 +76,33 @@ my $list_name; +=item --aliases=/full/path/to/aliases -=item --new=list_name my-list@example.com +Optional parametar C<--aliases> can be used to specify aliases file other +than default C. + +=cut + +my $aliases = $opt->{'aliases'} || '/etc/aliases'; + + +=item --create=list_name my-list@example.com Adds new list. You can also feed list name as first line to C. You can also add C<--from='Full name of list'> to specify full name (comment) in outgoing e-mail. -Optional parametar C<--aliases='/full/path/to/aliases'> can be used to -specify aliases file other than C. - =cut -if ($list_name = $opt->{'new'}) { +if ($list_name = $opt->{'create'}) { my $email = shift @ARGV || <>; chomp($email); die "need e-mail address for list (as argument or on STDIN)\n" unless ($email); - my $aliases = $opt->{'aliases'} || '/etc/aliases'; - - my $id = $nos->new_list( + my $id = $nos->create_list( list => $list_name, from => ($opt->{'from'} || ''), email => $email, @@ -106,6 +112,25 @@ print "added list $list_name with ID $id\n"; +=item --drop=list_name + +Remove list. + +Optional parametar C<--aliases='/full/path/to/aliases'> can be used to +specify aliases file other than C. + +=cut + +} elsif ($list_name = $opt->{'drop'}) { + + my $id = $nos->drop_list( + list => $list_name, + aliases => $aliases, + ) || die "can't remove list $list_name\n"; + + print "drop list $list_name with ID $id\n"; + + =item --list[=list_name] List all available lists and users on them.