]>
Commit | Line | Data |
---|---|---|
1 | package Gruntmaster::Page::Learn; | |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | use parent qw/Exporter/; | |
7 | our @EXPORT_OK = qw/generate/; | |
8 | our $VERSION = '0.001'; | |
9 | ||
10 | use constant FORMATS => [qw/CPP/]; | |
11 | use constant TITLE => 'Learn Perl'; | |
12 | ||
13 | use Fcntl qw/:flock/; | |
14 | use HTML::Template::Compiled; | |
15 | use IO::File; | |
16 | use YAML::Any qw/LoadFile/; | |
17 | use Gruntmaster::Page::Common qw/header footer/; | |
18 | ||
19 | my %templates = ( | |
20 | en => <<'HTML', | |
21 | Download interactive-perl-tutorial for <a href="ipt-linux">Linux</a> | <a href="ipt-windows.exe">Windows</a> | <a href="ipt-mac">Mac OS X</a>. | |
22 | <p>Get the source from <a href="http://example.org/">meta::cpan</a> | |
23 | HTML | |
24 | ); | |
25 | ||
26 | $templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates; | |
27 | $templates{$_} .= footer $_ for keys %templates; | |
28 | ||
29 | sub generate{ | |
30 | my $template = $templates{$_[1]}; | |
31 | my $htc = HTML::Template::Compiled->new(scalarref => \$template); | |
32 | $htc->output | |
33 | } | |
34 | ||
35 | 1 |