Re: Creating template from string
Mark Holland <
mark@...>
2005-07-21 08:42:27 GMT
Hi Michael,
I agree this would be a good feature to have. We are hoping to, in the
near future, create an I18N preprocessor, which will pre-process and
populate any i18n:translate tags which do not contain i18n:name tags.
The idea is to cache per-language versions of each template (maybe using
Cache::FileCache) which can be read into Petal for normal compilation
and processing. So being able to construct a template from a string
could be useful.
One thought though - how will Petal cache the complied version of a
template created from a string? Perhaps some sort of 'cache key' could
be passed to the constructor?
~mark
Michael Graham wrote:
>I'm the author of CGI::Application::Plugin::AnyTemplate, which tries to
>create a unified template API for CGI::Application. Currently it
>supports HTML::Template, Template::Toolkit and Petal.
>
>Where possible, I've tried to smooth over the API differences between
>the modules so that the user can switch templating systems without
>changing application code.
>
>One feature that I haven't been able to emulate in Petal is the ability
>to create a template from a string instead of a file.
>
> my $string = <<EOF;
(Continue reading)