package Gruntmaster::Page::Us;

use 5.014000;
use strict;
use warnings;
use parent qw/Exporter/;
our @EXPORT_OK = qw/generate/;
our $VERSION = '0.001';

use HTML::Template::Compiled;
use Gruntmaster::Data qw/users user_name/;
use Gruntmaster::Page::Common qw/cook_templates reload_templates/;

my %orig_templates = (
	en => <<'HTML',
<ul><tmpl_loop users><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
</tmpl_loop></ul>
HTML
);

my %templates = cook_templates %orig_templates, us => 'Users';

sub generate{
	%templates = cook_templates %orig_templates, us => 'Users' if reload_templates;
	my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});

	$htc->param(users => [ map { {id => $_, name => user_name} } users ]);
	$htc->output;
}

1
