]> iEval git - gruntmaster-page.git/blame - lib/Gruntmaster/Page/Us/Entry.pm
Add user list and user pages
[gruntmaster-page.git] / lib / Gruntmaster / Page / Us / Entry.pm
CommitLineData
4aa8ba86
MG
1package Gruntmaster::Page::Us::Entry;
2
3use 5.014000;
4use strict;
5use warnings;
6use parent qw/Exporter/;
7our @EXPORT_OK = qw/generate/;
8our $VERSION = '0.001';
9
10use HTML::Template::Compiled;
11use Gruntmaster::Data qw/users user_name user_town user_university user_level/;
12use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
13
14my %orig_templates = (
15 en => <<'HTML',
16<h1><tmpl_var name></h1>
17Town: <tmpl_var town><br>
18University: <tmpl_var university><br>
19Level: <tmpl_var level>
20HTML
21);
22
23my %templates = cook_templates %orig_templates, us_entry => '<tmpl_var name>';
24
25sub generate{
26 %templates = cook_templates %orig_templates, us_entry => '<tmpl_var name>' if reload_templates;
27 $_[0] =~ m,^us/([^/]+)\.html$,;
28 local $_ = $1;
29 my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
30
31 $htc->param(name => user_name);
32 $htc->param(town => user_town);
33 $htc->param(university => user_university);
34 $htc->param(level => user_level);
35 $htc->output;
36}
37
381
This page took 0.01696 seconds and 4 git commands to generate.