Template: ($template + $data) ==> document # normal Template::Extract: ($document + $template) ==> $data # tricky Template::Generate: ($data + $document) ==> $template # very tricky
In terms of ambition, I think this module ranks right up there with Parrot+Perl6. :-)
Actually, I have read about refactoring tools that look for duplicated or nearly duplicated source code that could be candidates for consolidation into subroutines. Implementing something similar would be an enormously useful addition to the Template::Toolkit (the BLOCK-ifier), and I would think it would be a achievable goal.
I'm using LEO's cloned nodes feature to fake this type of refactoring in ASP/CFM/HTML/XML/etc. The benefit is you can apply the concept of subroutine code consolidation to arbitrary blocks of text. A cloned node is simply a pointer to the block of text so that you can update it in one place, and have it reflected immediately in all other references. For the many languages a web/db developer works with that don't support that kind of reuse, it's a godsend. I should add that although most web languages do support some kind of include file syntax, I've found it much easier to use the cloned nodes as an intermediary step before I break things out into different parts of the filesystem. It's much easier to edit the files in context, and use LEO's outliner to show the structure of the document you're working with, and delaying having to commit to a certain file structure (in cvs,docs etc.) until as late as possible helps you name and organize things better.
There's a good LEO Tutorial w/ a perl example.