in reply to Template Toolkit "Pre-Processor"
You might want to look at Template::Multipass actually. It could be what you are looking for, or at least a start.