#!/usr/bin/perl use strict; use warnings; use POSIX; foreach my $user (`cd testing && ls`) { chomp $user; print "$user:"; open REP, ">testing/$user/REPORT" or die; print REP "Evaluation report for CEOI 2007 Day 1\n\n"; my $total = 0; foreach my $task (@ARGV) { print REP "### Task $task ###\n\n"; if (open PTS, "testing/$user/$task/points") { my $tt = 0; while () { chomp; my ($test, $pts, $comm) = /(\S+)\s+(\S+)\s+(.*)/; $comm =~ s/\.$//; printf REP "Test %2s: %2d points (%s)\n", $test, $pts, $comm; $tt += $pts; } close PTS; print REP "\nTOTAL: $tt points\n\n"; $total += $tt; print " $tt"; } else { print REP "No solution submitted.\n\n"; print " -"; } } print REP "### TOTAL FOR DAY 1 ###\n\n"; print REP "$total points\n"; print REP "\n\n(generated on ", strftime("%Y-%m-%d %H:%M:%S", localtime), ")\n"; close REP; print " -> $total\n"; }