]>
Commit | Line | Data |
---|---|---|
1 | package Gruntmaster::Page::Index; | |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | use parent qw/Exporter/; | |
7 | our @EXPORT_OK = qw/generate/; | |
8 | our $VERSION = '0.001'; | |
9 | ||
10 | use constant TITLE => 'Gruntmaster 6000'; | |
11 | ||
12 | use Fcntl qw/:flock/; | |
13 | use HTML::Template::Compiled; | |
14 | use IO::File; | |
15 | use Gruntmaster::Page::Common qw/header footer/; | |
16 | ||
17 | my %templates = ( | |
18 | en => <<'HTML', | |
19 | HTML | |
20 | ); | |
21 | ||
22 | $templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; | |
23 | $templates{$_} .= footer $_ for keys %templates; | |
24 | ||
25 | sub generate{ | |
26 | my $template = $templates{$_[1]}; | |
27 | my $htc = HTML::Template::Compiled->new(scalarref => \$template); | |
28 | IO::File->new('>meta.yml')->close unless -f 'meta.yml'; | |
29 | flock my $metafh = IO::File->new('<meta.yml'), LOCK_SH; | |
30 | $htc->output | |
31 | } | |
32 | ||
33 | 1 |