[htmltmpl] RFC: external caching
Brought to you by:
samtregar
From: Carl F. <ca...@fi...> - 2004-05-12 08:38:25
|
Hi all, I've coded and tested a new feature for the 'new' and 'output' methods and would like people's feedback on whether it might be accepted. This feature request allows a parsed template structure to be output as a scalar ref, which can be fed back to the new method again. Effectively this allows external caching. USAGE ----- You can obtain a template to be saved externally as such: $cache = $t->output( cache_ref => 1 ); The externally saved template can be loaded as such: my $t = HTML::Template->new( cacheref => $cache ); or my $t = HTML::Template->new_cache_ref( $cache ); or my $t = HTML::Template->new( type => 'cacheref', source => $cache ); REASON ------ I'm writing a web-app in which all configuration and data is saved in a database (excluding db connection vars). The application allows an admin to (online) edit existing templates and create new templates for new 'themes'. I have no desire to introduce the typical security hole of requiring '777' permission directories, just for the sake of the templating. Though I would like the benefit of some caching. I would be using the above to save the pre-parsed template in the database, which would be fed to all 'new' method calls. Before I post code, would it be best to submit a diff against the latest cpan release or the latest sourceforge cvs release? Cheers, Carl |