Subject: | Cache is not created properly |
Date: | Thu, 16 Aug 2018 19:11:01 +0000 |
To: | "bug-Template-Simple [...] rt.cpan.org" <bug-Template-Simple [...] rt.cpan.org> |
From: | "Morse, Richard E.,MGH" <REMORSE [...] mgh.harvard.edu> |
Hi! If you don’t pass any templates into the constructor (and thus, line
101 `$self->add_templates(…)` doesn’t actually add any templates), the
cache isn’t correctly created. Thus, any templates that are supposed to
retrieved via `_find_template()` or `_get_template()` don’t get added to
the cache, and thus get re-read every time.
An easy fix:
diff --git a/lib/Template/Simple.pm b/lib/Template/Simple.pm
index 92d79b4..e6a2297 100644
--- a/lib/Template/Simple.pm
+++ b/lib/Template/Simple.pm
@@ -98,6 +98,7 @@ sub new {
# load in any templates
+ $self->{tmpl_cache} = {} ;
$self->add_templates( $opts{templates} ) ;
return $self ;
The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.