--- /dev/null
+#! /usr/bin/perl
+use strict;
+use warnings;
+use DBI;
+use CGI;
+use CGI::Carp qw(fatalsToBrowser);
+use lib qw(/srv/bzr.sesse.net/www/xml-template/perl/);
+use XML::Template;
+require '../foosball.pm';
+
+my $cgi = CGI->new;
+
+my $username1 = $cgi->param('username1');
+$username1 =~ /^([a-z][a-z0-9]*)$/ or die "Invalid user name 1";
+$username1 = $1;
+
+my $username2 = $cgi->param('username2');
+$username2 =~ /^([a-z][a-z0-9]*)$/ or die "Invalid user name 2";
+$username2 = $1;
+
+my $dbh = foosball::db_connect();
+
+# fetch the single ratings
+my ($rating1, $rd1) = foosball::find_single_rating($dbh, $username1);
+my ($rating2, $rd2) = foosball::find_single_rating($dbh, $username2);
+
+open ASSESS, "/srv/foosball.sesse.net/foorank $rating1 $rd1 $rating2 $rd2 |"
+ or die "foorank: $!";
+
+my @results = ();
+while (<ASSESS>) {
+ my ($score, $prob, $rdiff1, $rdiff2) = split /,/, $_;
+ push @results, {
+ score => $score,
+ prob => (sprintf "%.3f", $prob),
+ rdiff1 => (sprintf "%+d", int($rdiff1+0.5)),
+ rdiff2 => (sprintf "%+d", int($rdiff2+0.5)),
+ };
+}
+
+print CGI->header(-type=>'application/xhtml+xml');
+
+my $doc = XML::Template::process_file('assess.xml', {
+ 'username1' => $username1,
+ 'username2' => $username2,
+ '#results' => \@results,
+});
+print $doc->toString;
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE
+ html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:t="http://template.sesse.net/">
+ <head>
+ <title>Foosball!</title>
+ <link rev="made" href="mailto:sgunderson@bigfoot.com" />
+ <meta name="MSSmartTagsPreventParsing" content="TRUE" />
+ </head>
+ <body>
+ <h1>Assessment of singles match between <t:username1 /> and <t:username2 /></h1>
+
+ <table>
+ <thead>
+ <tr>
+ <th>Score</th>
+ <th>Probability</th>
+ <th><t:username1 /></th>
+ <th><t:username2 /></th>
+ </tr>
+ </thead>
+ <tbody t:id="results">
+ <tr>
+ <td><t:score /></td>
+ <td><t:prob /></td>
+ <td><t:rdiff1 /></td>
+ <td><t:rdiff2 /></td>
+ </tr>
+ </tbody>
+ </table>
+
+ <p>Don't want to click the back button? <a href="/">Here's a link</a>, you
+ lazy sod.</p>
+ </body>
+</html>
+
</tr>
</tbody>
</table>
+
+ <h2>Assess a singles match</h2>
+
+ <form method="post" action="assess-single.pl">
+ <table>
+ <tr>
+ <th>User name 1</th>
+ <td><input name="username1" value="" size="10" /></td>
+ </tr>
+ <tr>
+ <th>User name 2</th>
+ <td><input name="username2" value="" size="10" /></td>
+ </tr>
+ <tr>
+ <td colspan="2"><input type="submit" /></td>
+ </tr>
+ </table>
+ </form>
+
<h2>About the ratings</h2>