in reply to Getting all used parameters from a Template::Toolkit template

I'd look at tie()ing the \%hashref that you're passing to Template->process(), so that it keeps track for you of what has (and therefore what has not) been accessed, via the FETCH method, and makes the results available through some "magic" key, as a first cut.

If it works (ie if TT doesn't break the tieing) then you could think about ways of tidying it up and turning the magic key into a method call on an object that wraps the tied hash. For examples of tieing and blessing at the same time, see DBM::Deep and Data::Transactional.

Replies are listed 'Best First'.
Re^2: Getting all used parameters from a Template::Toolkit template
by Corion (Patriarch) on Mar 11, 2009 at 10:27 UTC

    This is a good idea, but I fear from the output of the Stash code in 749819 that Template::Toolkit first builds a complete (in-memory) copy of the available data in its stash and then processes the template from that. But it sure is worth a try.