]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Us/Entry.pm
Make all generators inherit from a common base
[gruntmaster-page.git] / lib / Gruntmaster / Page / Us / Entry.pm
index 5d493ba9fb02518ba51e1e1831f2821eb9ac1c96..cfd9b36bfb22d9c2f0924041e38c65dfd021eb05 100644 (file)
@@ -3,36 +3,29 @@ package Gruntmaster::Page::Us::Entry;
 use 5.014000;
 use strict;
 use warnings;
-use parent qw/Exporter/;
-our @EXPORT_OK = qw/generate/;
+use Gruntmaster::Page::Base us_entry => '<tmpl_var name>';
+our @ISA = qw/Gruntmaster::Page::Base/;
 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 = (
+use constant 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{
+       my ($self, $htc, $path, $lang) = @_;
 
-sub generate{
-       %templates = cook_templates %orig_templates, us_entry => '<tmpl_var name>' if reload_templates;
-       $_[0] =~ m,^us/([^/]+)\.html$,;
+       $path =~ 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.024952 seconds and 4 git commands to generate.