--- processmail/collection.pl 2008/03/23 17:50:49 3.0 +++ processmail/collection.pl 2013/10/11 15:39:35 3.2 @@ -1,20 +1,23 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # -#$Id: collection.pl,v 3.0 2008/03/23 17:50:49 boris Exp $ +#$Id: collection.pl,v 3.2 2013/10/11 15:39:35 boris Exp $ # # Собрание сочинений # - use Getopt::Std; + +use Getopt::Std; $usage = -"Usage: collection.pl [-d] [-t table_file] [-o results] \n"; +"Usage: collection.pl [-d] [-s|-m] [-t table_file] [-o results] \n"; require 'parameters.pl'; require 'subroutines.pl'; -die $usage unless getopts('t:o:d'); +die $usage unless getopts('t:o:dsm'); $DEBUG=$opt_d; +$SHORT=$opt_s; +$MEDIUM=$opt_m; # Находим максимальный вопрос $MAXQUEST=1; @@ -42,7 +45,7 @@ if ($opt_t) # Читаем ответы команд # for (my $i=1; $i<=$ROUNDS; $i++) { - foreach my $file (split /\s+/, $FILES[$i]) { + foreach my $file ( @{$FILES[$i]} ) { open (INFILE, $file); readmail(\%teams); collect_answers(\%teams,\@answers); @@ -50,6 +53,7 @@ for (my $i=1; $i<=$ROUNDS; $i++) { } } +# # Пишем измененную таблицу в файл. # if ($opt_o) @@ -60,18 +64,24 @@ if ($opt_o) 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,'?'); + if ( ! $SHORT || countanswers(\%teams,\@answers,$i,'+') ) { + print "\nЗАСЧИТАНО:\n"; + anondump(\%teams,\@answers,$i,'+'); + } + if ( ! $SHORT || countanswers(\%teams,\@answers,$i,'+') ) { + print "\nНЕ ЗАСЧИТАНО:\n"; + anondump(\%teams,\@answers,$i,'-'); + } + if ( ! ($SHORT || $MEDIUM) || countanswers(\%teams,\@answers,$i,'?') ) { + print "\nНЕ ЯСНО:\n"; + anondump(\%teams,\@answers,$i,'?'); + } + print "\n"; # Added by LG for better readability } print "***\n"; - - - - - +# +# На всякий случай проверяем на наличие команд с дублирующимися номерами. +# +check_dup_numbers(\%teams);