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

#!/usr/local/bin/perl
#
#$Id: collection.pl,v 3.0 2008/03/23 17:50:49 boris Exp $
#
# Собрание сочинений
#
    use Getopt::Std; 

$usage = 
"Usage: collection.pl [-d] [-t table_file]  [-o results] \n";

require 'parameters.pl';
require 'subroutines.pl';

die $usage unless getopts('t:o:d');

$DEBUG=$opt_d;

# Находим максимальный вопрос
$MAXQUEST=1;
for (my $i=1; $i<=$ROUNDS; $i++) {
    if ($MAXQUEST<$MAXQUEST[$i]) {
	$MAXQUEST=$MAXQUEST[$i];
    }
}



my %teams;
my @answers;
#
# Читаем старые результаты
#
if ($opt_t)
{
    die "Cannot open $opt_t\n" unless open(INFILE,$opt_t);
    readhash(\@answers);
    close(INFILE);
}

#
# Читаем ответы команд
#
for (my $i=1; $i<=$ROUNDS; $i++) {
    foreach my $file (split /\s+/, $FILES[$i]) {
	open (INFILE, $file);
	readmail(\%teams);
	collect_answers(\%teams,\@answers);
	close (INFILE);
    }
}

# Пишем измененную таблицу в файл.
#
if ($opt_o)
{ 
    die "Cannot open $opt_o\n" unless open(OUTFILE,">$opt_o");
    select OUTFILE;
}
for ($i=1;$i<=$MAXQUEST;$i++)
{
    print "\nВОПРОС $i:\n";
    print "\nЗАСЧИТАНО:\n";
    anondump(\%teams,\@answers,$i,'+');
    print "\nНЕ ЗАСЧИТАНО:\n";
    anondump(\%teams,\@answers,$i,'-');
    print "\nНЕ ЯСНО:\n";
    anondump(\%teams,\@answers,$i,'?');
}
print "***\n";








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