Template2
Template2 copied to clipboard
[wishlist] Add 'preload' method to store in-memory templates
I sometimes wish I could add a precompiled template under some name for the subsequent code to rely on it. My idea of the interface is like follows:
$tt->preload( "name" => \"[% in_memory_template %]" );
# later in the code
$tt->process( "name", \%vars );
# will now work on the provided template
# instead or looking for it in INCLUDE_PATH
I managed to make a wrapper based on Template::Provider to add such feature to my particular code, but I would love to see it in Template by default.
Or maybe there's a standard way of doing this, but I haven't found it in the docs.
Would love to make a pull request for this if anybody else could need such thing.
@dallaylaen do you want to submit a PR so we can look at it?