]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Us/Entry.pm
Add user list and user pages
[gruntmaster-page.git] / lib / Gruntmaster / Page / Us / Entry.pm
diff --git a/lib/Gruntmaster/Page/Us/Entry.pm b/lib/Gruntmaster/Page/Us/Entry.pm
new file mode 100644 (file)
index 0000000..5d493ba
--- /dev/null
@@ -0,0 +1,38 @@
+package Gruntmaster::Page::Us::Entry;
+
+use 5.014000;
+use strict;
+use warnings;
+use parent qw/Exporter/;
+our @EXPORT_OK = qw/generate/;
+our $VERSION = '0.001';
+
+use HTML::Template::Compiled;
+use Gruntmaster::Data qw/users user_name user_town user_university user_level/;
+use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
+
+my %orig_templates = (
+       en => <<'HTML',
+<h1><tmpl_var name></h1>
+Town: <tmpl_var town><br>
+University: <tmpl_var university><br>
+Level: <tmpl_var level>
+HTML
+);
+
+my %templates = cook_templates %orig_templates, us_entry => '<tmpl_var name>';
+
+sub generate{
+       %templates = cook_templates %orig_templates, us_entry => '<tmpl_var name>' if reload_templates;
+       $_[0] =~ m,^us/([^/]+)\.html$,;
+       local $_ = $1;
+       my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
+
+       $htc->param(name => user_name);
+       $htc->param(town => user_town);
+       $htc->param(university => user_university);
+       $htc->param(level => user_level);
+       $htc->output;
+}
+
+1
This page took 0.017224 seconds and 4 git commands to generate.