From: Simon McVittie Date: Tue, 1 Jul 2014 07:23:13 +0000 (+0100) Subject: edittemplate: only generate a UUID on-demand X-Git-Tag: 3.20140916~43^2~5 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/4a11dc4d16463ed0afaf387d0c33d00ba639f52e edittemplate: only generate a UUID on-demand If the template doesn't use there's no point in incurring any cost. --- diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 6e8c256da..b408dfcac 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -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; }