]> iEval git - gruntmaster-page.git/blob - lib/Gruntmaster/Page/Us/Entry.pm
Add user list and user pages
[gruntmaster-page.git] / lib / Gruntmaster / Page / Us / Entry.pm
1 package Gruntmaster::Page::Us::Entry;
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 HTML::Template::Compiled;
11 use Gruntmaster::Data qw/users user_name user_town user_university user_level/;
12 use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
13
14 my %orig_templates = (
15 en => <<'HTML',
16 <h1><tmpl_var name></h1>
17 Town: <tmpl_var town><br>
18 University: <tmpl_var university><br>
19 Level: <tmpl_var level>
20 HTML
21 );
22
23 my %templates = cook_templates %orig_templates, us_entry => '<tmpl_var name>';
24
25 sub 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
38 1
This page took 0.039845 seconds and 4 git commands to generate.