From 4a11dc4d16463ed0afaf387d0c33d00ba639f52e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 1 Jul 2014 08:23:13 +0100 Subject: [PATCH] edittemplate: only generate a UUID on-demand If the template doesn't use there's no point in incurring any cost. --- IkiWiki/Plugin/edittemplate.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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; } -- 2.39.5