I have been using the Template Toolkit for a while now and have come across some issues. I was wondering if anyone else had similar experiences, and if there is anything to be done about them aside from contacting the Module's authors.

The application I am working uses the toolkit to, among other things, format a list of records pulled from a database. The dilemma is that with caching enabled (the default state) when the number of entries pulled from the database varies, the change is not reflected in the resulting output. This was confusing, as I'd expect caching to only affect the template itself, and that the placeholders in the templates would be populated anew each time. I tried to enable template compiling with similar results.

As an aside on this journey, for some reason my templates only get re-processed when I change the source code file calling the template. It does not seem to check if the original template file has changed (this is for caching. I did not check for compiling).

Continuing on, while I wanted very much to use caching, I decided that I should try to disable caching to see if the updates to the database would then be reflected in the templates. so i dutifully said:

my $template = Template->new({INCLUDE_PATH => 'e:/web_projects/marksphotos/templates/',DELIMITER=>';',CACHE_SIZE=>0});

To which I got the less than gratifying response:

Undefined subroutine &Template::Service::confess called at c:/Perl/site/lib/Template/Service.pm line 183.

I was running toolkit v2.0. I checked the website and found that 2.02 was out. I dutifully downloaded and installed the upgrade, and tried again, with the disabled cache. Now I get:

Not a GLOB reference at c:/Perl/site/lib/Template/Provider.pm line 506.

Is anyone aware of anything like this, or should I take it up with the Module authors? I will post source if requested. FYI, I am using ActiveState Build 616 on Win32. This is a 5.6.0 build.


In reply to Template Toolkit and Caching by AidanLee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.