File:  [Local Repository] / processmail / reminder.pl
Revision 3.0: download - view: text, annotated - select for diffs - revision graph
Sun Mar 23 17:50:50 2008 UTC (16 years, 3 months ago) by boris
Branches: MAIN
CVS tags: HEAD
Added Lev's corrections

    1: #!/usr/local/bin/perl
    2: #
    3: #$Id: reminder.pl,v 3.0 2008/03/23 17:50:50 boris Exp $
    4: #
    5: # Читаем файл и шлем e-mail
    6: #
    7: #
    8: # Исходные файлы и параметры
    9: #
   10: 
   11:     use Getopt::Std; 
   12: 
   13: $usage = 'reminder.pl $Revision: 3.0 $, $Date: 2008/03/23 17:50:50 $'. "\n".
   14: "Usage: reminder.pl [-d] [-r round]  [-o results] \n";
   15: 
   16: require 'parameters.pl';
   17: require 'subroutines.pl';
   18: 
   19: die $usage unless getopts('r:o:d');
   20: 
   21: $DEBUG=$opt_d;
   22: 
   23: my %teams;
   24: 
   25: #
   26: # Читаем ответы команд
   27: #
   28: $round=0;
   29: if ($opt_r)
   30: {
   31:     $round=$opt_r;
   32:     foreach my $file ( @{$FILES[$opt_r]} ) {
   33: 	open (INFILE, $file);
   34: 	readmail(\%teams);
   35: 	close (INFILE);
   36:     }
   37: }
   38: else
   39: {
   40:     *INFILE=*STDIN;
   41: }
   42: readmail(\%teams);
   43: close(INFILE);
   44: #
   45: # Пишем мейл
   46: #
   47: if ($opt_o)
   48: { 
   49:     die "Cannot open $opt_o\n" unless open(OUTFILE,">$opt_o");
   50: }
   51: else
   52: {
   53:     open(OUTFILE,"|/usr/lib/sendmail -oi -t");
   54: }
   55: select OUTFILE;
   56: &printheader;
   57: foreach $team (keys %teams)
   58: {
   59:     my $num=$teams{$team}->{'numletters'};
   60:     print  "$team [$num]\n";
   61: }
   62: 
   63: &printfooter;
   64: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>