I am creating a HTML template that I want populate only some of the variables (TMPL_VARs) in it, then output it to a file that I will call again at a later date to populate the rest of the variables. So basically I want to escape some of the TMPL variables so they can be populated on the second pass.
<TMPL_VAR NAME="title_pass1">
<TMPL_VAR NAME="content_pass2">
<TMPL_VAR NAME="footer_pass1">
The only solutions i can think of is to set the second pass of vars to &lt;TMPL_VAR NAME=test> and either:
1. output the first pass to a file, then call the new template with the filter param which converts all /&lt;TMPL/<TMPL/g. I don't like this way as it has to run a regexp subst on each template as it's loaded, and the second pass is the one that is used more often, the first pass is just to create the structure for the second pass.
2. store template output into a scalar and to a regexp subst on the scalar before printint that to the file.
my $templateRef = $template->output;
$templateRef =~ s/&lt;TMPL_/<TMPL_/g;
print TEMP $templateRef;
As I am writing this I think I'm going to go with solution 2 as it outputs the file and doesn't require any filter on loading the second template.
Any feedback on this would be great though, otherwise maybe this might help someone else who is looking for a similar solution.

Bees, cows, tigers and more! Windows Live Messenger treats you to 30 free emoticons.