]>
iEval git - plack-app-gruntmaster.git/blob - Page/Ct/Entry.pm
1 package Gruntmaster
::Page
::Ct
::Entry
;
6 use parent qw
/Exporter/;
7 our @EXPORT_OK = qw
/generate/;
8 our $VERSION = '0.001';
11 use HTML
::Template
::Compiled
;
13 use POSIX qw
/strftime/;
14 use YAML
::Any qw
/LoadFile/;
15 use File
::Basename qw
/fileparse/;
16 use File
::Slurp qw
/slurp/;
17 use Gruntmaster
::Page
::Common qw
/header footer/;
19 use constant TITLE
=> '<tmpl_var name>';
23 Contest start time: <tmpl_var start><br>
24 Contest end time: <tmpl_var end><p>
26 <tmpl_if started><a href="pb/">Problems</a><br>
27 <a href="log/">Job log</a><br>
28 <a href="st/">Standings</a></tmpl_if>
32 $templates{$_} = header
($_, TITLE
) . $templates{$_} for keys %templates;
33 $templates{$_} .= footer
$_ for keys %templates;
36 my ($path, $lang) = @_;
37 $path = ($path =~ m
,ct
/(.*)/index
,)[0];
38 my $template = $templates{$lang};
39 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$template);
40 flock my $metafh = IO
::File
->new("<ct/$path/meta.yml"), LOCK_SH
;
41 my $meta = LoadFile
"ct/$path/meta.yml";
43 $htc->param(id
=> $path);
44 $htc->param(name
=> $meta->{name
});
45 $htc->param(start
=> strftime
'%c', localtime $meta->{start
});
46 $htc->param(end
=> strftime
'%c', localtime $meta->{end
});
47 $htc->param(started
=> time >= $meta->{start
});
This page took 0.042887 seconds and 4 git commands to generate.