X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FLearn.pm;h=171a184ae5eeb6e211784239d3833fc5f88eb72d;hb=2b0036ac8e077cc20cf9db6ff8dad4091ab50cb3;hp=8fce8c8dc213a4aacac9957d4d79fd46cf4bae27;hpb=12f5cac9d95e04bb84e47952dd938031557b57c4;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Learn.pm b/lib/Gruntmaster/Page/Learn.pm index 8fce8c8..171a184 100644 --- a/lib/Gruntmaster/Page/Learn.pm +++ b/lib/Gruntmaster/Page/Learn.pm @@ -7,29 +7,21 @@ use parent qw/Exporter/; our @EXPORT_OK = qw/generate/; our $VERSION = '0.001'; -use constant FORMATS => [qw/CPP/]; -use constant TITLE => 'Learn Perl'; - -use Fcntl qw/:flock/; use HTML::Template::Compiled; -use IO::File; -use YAML::Any qw/LoadFile/; -use Gruntmaster::Page::Common qw/header footer/; +use Gruntmaster::Page::Common qw/cook_templates reload_templates/; -my %templates = ( +my %orig_templates = ( en => <<'HTML', -Download interactive-perl-tutorial for Linux | Windows | Mac OS X. -

Get the source from meta::cpan +Install interactive-perl-tutorial from your nearest CPAN mirror. Run cpan App::InteractivePerlTutorial. +

You can also get the source from git.ieval.ro HTML ); -$templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; -$templates{$_} .= footer $_ for keys %templates; +my %templates = cook_templates %orig_templates, learn => 'Learn'; sub generate{ - my $template = $templates{$_[1]}; - my $htc = HTML::Template::Compiled->new(scalarref => \$template); - $htc->output + %templates = cook_templates %orig_templates, learn => 'Learn' if reload_templates; + HTML::Template::Compiled->new(scalarref => \$templates{$_[1]})->output; } 1