/[notice-sender]/trunk/sender.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/sender.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6 by dpavlin, Sat May 14 12:31:27 2005 UTC revision 8 by dpavlin, Sat May 14 13:12:00 2005 UTC
# Line 9  use Data::Dumper; Line 9  use Data::Dumper;
9    
10  sender.pl - command line notify sender utility  sender.pl - command line notify sender utility
11    
12    =head1 SYNOPSYS
13    
14     sender.pl --add=mylist members.txt
15     sender.pl --list
16     sender.pl --queue=mylist message.txt
17     sender.pl --send=mylist
18    
19    =head2 All options
20    
21    =over 20
22    
23    =item --debug
24    
25    Turn on debugging output from C<Class::DBI>
26    
27  =cut  =cut
28    
29  my ($list_opt,$debug) = (0,0);  my ($list_opt,$debug) = (0,0);
# Line 40  my $user_list = $loader->find_class('use Line 55  my $user_list = $loader->find_class('use
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
59    
60    List all available lists and users on them
61    
62    =cut
63    
64  if ($list_opt) {  if ($list_opt) {
65          foreach my $list ($lists->retrieve_all) {          foreach my $list ($lists->retrieve_all) {
66                  print $list->name,"\n";                  print $list->name,"\n";
# Line 48  if ($list_opt) { Line 69  if ($list_opt) {
69                          print "\t",$user->full_name," <", $user->email, ">\n";                          print "\t",$user->full_name," <", $user->email, ">\n";
70                  }                  }
71          }          }
72    
73    =item --add=list_name
74    
75    Add users to list. Users are stored in file (which can be supplied as
76    argument) or read from C<STDIN>. List should be in following format:
77    
78     email@example.com      Optional full name of person
79     dpavlin@rot13.org      Dobrica Pavlinusic
80    
81    =cut
82    
83  } elsif ($add_opt) {  } elsif ($add_opt) {
84          #my $noticer = $loader->find_class('Noticer') || die "can't find my class!";          #my $noticer = $loader->find_class('Noticer') || die "can't find my class!";
85          my $list = $lists->find_or_create({          my $list = $lists->find_or_create({
# Line 79  if ($list_opt) { Line 111  if ($list_opt) {
111    
112          print "list ",$list->name," has $added users\n";          print "list ",$list->name," has $added users\n";
113    
114    =item --queue=list_name
115    
116    Queue message for later delivery. Message can be read from file (specified as
117    argument) or read from C<STDIN>.
118    
119    =cut
120    
121  } elsif ($queue_opt) {  } elsif ($queue_opt) {
122          my $this_list = $lists->search(          my $this_list = $lists->search(
123                  name => $queue_opt,                  name => $queue_opt,
# Line 105  if ($list_opt) { Line 144  if ($list_opt) {
144          print "added message ",$this_message->id, " to list ",$this_list->name,"\n";          print "added message ",$this_message->id, " to list ",$this_list->name,"\n";
145    
146  } else  {  } else  {
147          die $0.'          die "see perldoc $0 for help";
         --list                          show all lists and users  
         --add=name_of_list < users.txt  add users (email@example.com full name)  
         --queue=name_of_list < message  queue message for sending to list  
         --debug  
 ';  
148  }  }
149    
150    =back
151    
152    =head1 AUTHOR
153    
154    Dobrica Pavlinusic <dpavlin@rot13.org>
155    
156    =cut
157    

Legend:
Removed from v.6  
changed lines
  Added in v.8

  ViewVC Help
Powered by ViewVC 1.1.26