]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/St.pm
Make all generators inherit from a common base
[gruntmaster-page.git] / lib / Gruntmaster / Page / St.pm
index e3873ba51b418de037516ca24a52b7470f898757..dafd5df249e21b1604441d1ba0033e12b4a3080c 100644 (file)
@@ -3,17 +3,11 @@ package Gruntmaster::Page::St;
 use 5.014000;
 use strict;
 use warnings;
-use parent qw/Exporter/;
-our @EXPORT_OK = qw/generate/;
+use Gruntmaster::Page::Base st => 'Standings';
+our @ISA = qw/Gruntmaster::Page::Base/;
 our $VERSION = '0.001';
 
-use HTML::Template::Compiled;
-use List::Util qw/sum/;
-use POSIX qw/strftime/;
-use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
-use Gruntmaster::Data qw/problems jobcard job_result_text job_result job_problem job_user/;
-
-my %orig_templates = (
+use constant => TEMPLATES => {
        en => <<'HTML',
 <table border>
 <thead>
@@ -25,14 +19,12 @@ my %orig_templates = (
 </tmpl_loop>
 </table>
 HTML
-);
+};
 
-my %templates = cook_templates %orig_templates, st => 'Standings';
+sub _generate{
+       my ($self, $htc, $path, $lang) = @_;
 
-sub generate{
-       %templates = cook_templates %orig_templates, st => 'Standings' if reload_templates;
-       local $Gruntmaster::Data::contest = ($_[0] =~ m,^ct/([^/]+)/,)[0];
-       my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
+       local $Gruntmaster::Data::contest = ($path =~ m,^ct/([^/]+)/,)[0];
 
        my @problems = sort problems;
        my %scores;
@@ -54,7 +46,6 @@ sub generate{
        } keys %scores;
        $htc->param(problems => \@problems);
        $htc->param(st => \@st);
-       $htc->output
 }
 
 1
This page took 0.017879 seconds and 4 git commands to generate.