]> iEval git - gruntmaster-page.git/blobdiff - lib/Gruntmaster/Page/Account.pm
Centralize template cooking and introduce reloadable templates
[gruntmaster-page.git] / lib / Gruntmaster / Page / Account.pm
index f757e9fe08b859b4853627bac9cf0a1889782ae5..20acc6ab30e6731f6f0786acd3d18edb8915426c 100644 (file)
@@ -7,12 +7,10 @@ use parent qw/Exporter/;
 our @EXPORT_OK = qw/generate/;
 our $VERSION = '0.001';
 
-use constant TITLE => 'Account';
-
 use HTML::Template::Compiled;
-use Gruntmaster::Page::Common qw/header footer patch_templates/;
+use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
 
-my %templates = (
+my %orig_templates = (
   en => <<'HTML',
 <div id="result"></div>
 
@@ -48,12 +46,10 @@ Confirm new password:<br>
 HTML
 );
 
-patch_templates %templates, 'account';
-
-$templates{$_}  = header($_, TITLE) . $templates{$_} for keys %templates;
-$templates{$_} .= footer $_ for keys %templates;
+my %templates = cook_templates %orig_templates, account => 'Account';
 
 sub generate{
+  %templates = cook_templates %orig_templates, account => 'Account' if reload_templates;
   HTML::Template::Compiled->new(scalarref => \$templates{$_[1]})->output
 }
 
This page took 0.026206 seconds and 4 git commands to generate.