]>
iEval git - plack-app-gruntmaster.git/blob - Gruntmaster/Page/Pb.pm
1 package Gruntmaster
::Page
::Pb
;
6 use parent qw
/Exporter/;
7 our @EXPORT_OK = qw
/generate/;
8 our $VERSION = '0.001';
10 use constant TITLE
=> 'Problems';
13 use HTML
::Template
::Compiled
;
15 use POSIX qw
/strftime/;
16 use YAML
::Any qw
/LoadFile/;
17 use Gruntmaster
::Page qw
/header footer/;
22 <tmpl_loop problems><li><a href="<tmpl_var id>"><tmpl_var name></a>
27 $templates{$_} = header
($_, TITLE
) . $templates{$_} for keys %templates;
28 $templates{$_} .= footer
$_ for keys %templates;
31 my ($path, $lang) = @_;
32 $path =~ s
,/index\
.html
$,,;
33 my $template = $templates{$lang};
34 my $htc = HTML
::Template
::Compiled
->new(scalarref
=> \
$template);
35 IO
::File
->new(">$path/meta.yml")->close unless -f
"$path/meta.yml";
36 flock my $metafh = IO
::File
->new("<$path/meta.yml"), LOCK_SH
;
37 my @problems = sort { $b->{name
} cmp $a->{name
} } map {
38 my $meta = LoadFile
$_;
39 my $id = (m
,^$path/(.*)/meta
.yml
$,)[0];
40 +{ id
=> $id, name
=> $meta->{name
} } } <$path/*/meta
.yml
>;
41 $htc->param(problems
=> \
@problems);
This page took 0.045867 seconds and 4 git commands to generate.