X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FIndex.pm;h=0214ea6b5c906de88d294e36270f0f131d05dc07;hb=2b0036ac8e077cc20cf9db6ff8dad4091ab50cb3;hp=604be12c057c27eb721687b12e3d39b043eb7101;hpb=832cb45e325364ca1de645a2256efa69284fcf06;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Index.pm b/lib/Gruntmaster/Page/Index.pm index 604be12..0214ea6 100644 --- a/lib/Gruntmaster/Page/Index.pm +++ b/lib/Gruntmaster/Page/Index.pm @@ -7,27 +7,19 @@ use parent qw/Exporter/; our @EXPORT_OK = qw/generate/; our $VERSION = '0.001'; -use constant TITLE => 'Gruntmaster 6000'; - -use Fcntl qw/:flock/; use HTML::Template::Compiled; -use IO::File; -use Gruntmaster::Page::Common qw/header footer/; +use Gruntmaster::Page::Common qw/cook_templates reload_templates/; -my %templates = ( +my %orig_templates = ( en => <<'HTML', HTML ); -$templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; -$templates{$_} .= footer $_ for keys %templates; +my %templates = cook_templates %orig_templates, index => 'Gruntmaster 6000'; sub generate{ - my $template = $templates{$_[1]}; - my $htc = HTML::Template::Compiled->new(scalarref => \$template); - IO::File->new('>meta.yml')->close unless -f 'meta.yml'; - flock my $metafh = IO::File->new('output + %templates = cook_templates %orig_templates, index => 'Gruntmaster 6000' if reload_templates; + HTML::Template::Compiled->new(scalarref => \$templates{$_[1]})->output } 1