yucca has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,
I have a site with a lot of pages, 90% of which follow just several basic templates. I'm trying to move the text to the database and use a Perl templating scripts. The text doesn't change very often, so I need caching to speed thing up.

I've never used any templating or caching modules before and there seem to be several of them, which ones you think will best fit our needs? We're on NFS system (I recall some caching module didn't work with it) and don't have mod_perl if this matters. Thanks!

  • Comment on What module to use for templates and caching?

Replies are listed 'Best First'.
Re: What module to use for templates and caching?
by jettero (Monsignor) on Jun 05, 2007 at 22:48 UTC
    HTML::Template seems to be pretty popular, usually in combination with CGI::Simple. Sounds like you don't really need the second part though, just a Makefile? What I mean is, there's no need to serve the content dynamically if it's not changing very often.

    So just generate a new HTML file each time the content changes in the database rather than using all that mod_perl power...

    -Paul

      Thanks Paul. Sorry it took me so long to reply, I was on extended vacation :) The problem with this approach is that it will require too much disk space. We will have tens of thousands of static pages then and many of them are accessed quite rarely, so it doesn't make a lot of sense to keep them around all the time.
Re: What module to use for templates and caching?
by Herkum (Parson) on Jun 06, 2007 at 00:16 UTC
    Template is a good complete templating system, but it also provides the ability to compile templates. That would help if performance is an issue.
Re: What module to use for templates and caching?
by Trizor (Pilgrim) on Jun 06, 2007 at 01:21 UTC
    Template has been mentioned as a template engine, and templates may be precompiled which is a performance plus. You're not working in mod_perl and the fact that you mentioned NFS makes me think there may be more than one server but Cache or Cache::Cache should be able to put their filecache on the NFS, though NFS becomes a bottleneck if you frequently write to the cache (which defeats the point of the Cache).
Re: What module to use for templates and caching?
by strat (Canon) on Jun 06, 2007 at 08:58 UTC
Re: What module to use for templates and caching?
by naikonta (Curate) on Jun 06, 2007 at 15:28 UTC
    This article discusses about various templating system along with their merits.

    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

Re: What module to use for templates and caching?
by tinita (Parson) on Jun 06, 2007 at 20:18 UTC
    about caching: in the framework i'm developing i have a cache module which allows to use either a file cache as a backend or memcached. the file caching was written by myself, but i'll probably rewrite it with Cache::FileCache.

    the advantage is that you can use file caching and don't need to set up a memcached server, but as soon as you need to scale your application and have more than one server, you can switch to memcached without changing anything but the configuration.