File:  [Local Repository] / processmail / reminder.pl
Revision 3.2: download - view: text, annotated - select for diffs - revision graph
Fri Oct 11 15:39:35 2013 UTC (10 years, 8 months ago) by boris
Branches: MAIN
CVS tags: HEAD
Lev's changes

    1: #!/usr/bin/perl
    2: #
    3: #$Id: reminder.pl,v 3.2 2013/10/11 15:39:35 boris Exp $
    4: #
    5: # Читаем файл и шлем e-mail
    6: #
    7: #
    8: # Исходные файлы и параметры
    9: #
   10: 
   11:     use Getopt::Std; 
   12: 
   13: $usage = 'reminder.pl $Revision: 3.2 $, $Date: 2013/10/11 15:39:35 $'. "\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: #
   48: if ($opt_o)
   49: { 
   50:     die "Cannot open $opt_o\n" unless open(OUTFILE,">$opt_o");
   51: }
   52: else
   53: {
   54:     open(OUTFILE,"|/usr/lib/sendmail -oi -t");
   55: }
   56: select OUTFILE;
   57: &printheader;
   58: my $numletters=0;
   59: foreach $team (keys %teams)
   60: {
   61:     my $num=$teams{$team}->{'numletters'};
   62:     print  "$team [$num]\n";
   63:     $numletters += $num;
   64: }
   65: 
   66: print "\n------------------\n";
   67: printf("Всего команд: %3d\n", scalar keys %teams);
   68: printf("Всего писем:  %3d\n", $numletters);
   69: 
   70: &printfooter;
   71: 
   72: #
   73: # На всякий случай проверяем на наличие команд с дублирующимися номерами.
   74: #
   75: check_dup_numbers(\%teams);

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