edittemplate: only generate a UUID on-demand

If the template doesn't use <TMPL_VAR UUID> there's no point in
incurring any cost.
master
Simon McVittie 2014-07-01 08:23:13 +01:00
parent 7aa10a2952
commit 4a11dc4d16
1 changed files with 9 additions and 7 deletions

View File

@ -139,13 +139,15 @@ sub filltemplate ($$) {
$template->param(name => $page);
eval {
require UUID::Tiny;
UUID::Tiny->import(':std');
my $uuid;
$uuid = create_uuid_as_string(UUID_V4());
$template->param(uuid => $uuid);
};
if ($template->query(name => 'uuid')) {
eval {
require UUID::Tiny;
UUID::Tiny->import(':std');
my $uuid;
$uuid = create_uuid_as_string(UUID_V4());
$template->param(uuid => $uuid);
};
}
return $template->output;
}