12 |
=head1 SYNOPSYS |
=head1 SYNOPSYS |
13 |
|
|
14 |
sender.pl --add=mylist members.txt |
sender.pl --add=mylist members.txt |
15 |
sender.pl --list |
sender.pl --list[=mylist] |
16 |
sender.pl --queue=mylist message.txt |
sender.pl --queue=mylist message.txt |
17 |
sender.pl --send=mylist |
sender.pl --send=mylist |
18 |
|
|
31 |
my $queue_opt; |
my $queue_opt; |
32 |
|
|
33 |
my $result = GetOptions( |
my $result = GetOptions( |
34 |
"list" => \$list_opt, |
"list:s" => \$list_opt, |
35 |
"add=s" => \$add_opt, |
"add=s" => \$add_opt, |
36 |
"queue=s" => \$queue_opt, |
"queue=s" => \$queue_opt, |
37 |
"debug" => \$debug, |
"debug" => \$debug, |
55 |
my $messages = $loader->find_class('messages'); |
my $messages = $loader->find_class('messages'); |
56 |
my $message_list = $loader->find_class('message_list'); |
my $message_list = $loader->find_class('message_list'); |
57 |
|
|
58 |
=item --list |
=item --list[=list_name] |
59 |
|
|
60 |
List all available lists and users on them |
List all available lists and users on them. Optional value is name of list |
61 |
|
and it will produce users just on that list. |
62 |
|
|
63 |
=cut |
=cut |
64 |
|
|
65 |
if ($list_opt) { |
if (defined($list_opt)) { |
66 |
foreach my $list ($lists->retrieve_all) { |
my @lists; |
67 |
|
if ($list_opt ne '') { |
68 |
|
@lists = $lists->search( name=> $list_opt )->first || die "can't find list $list_opt"; |
69 |
|
} else { |
70 |
|
@lists = $lists->retrieve_all; |
71 |
|
} |
72 |
|
|
73 |
|
foreach my $list (@lists) { |
74 |
print $list->name,"\n"; |
print $list->name,"\n"; |
75 |
foreach my $user_on_list ($user_list->search(list_id => $list->id)) { |
foreach my $user_on_list ($user_list->search(list_id => $list->id)) { |
76 |
my $user = $users->retrieve( id => $user_on_list->user_id ); |
my $user = $users->retrieve( id => $user_on_list->user_id ); |