So I've again been playing around with the idea of a Template Toolkit Language plugin for AxKit. Developing the example in kip's book to work with XML::LibXML. Which should be really easy, apart from the fact that Template::Plugin::XML::LibXML wasn't passing tests. Ooops. Much patching of the tests and a release to CPAN yesterday fixed that.
So I've been actually trying to use Apoche::Test to test this module and I'm slowly getting there. It's quite swish when it works (we don't use it ourselves at work because apparently it's too clever and autodetects things outside of our build system!) I'm currently playing with writing dummy AxKit lanaguages that unconditionally dump different things in the pipeline so that I can test that the TT language reads and understands the previous data from the pipeline fine.
Once I've got the basic version done there's still big problems ahead. Firstly, there's the issue of caching. Currently I'm creating a new TT object every time, which means that every single time a TT stylesheet is used it's turning the template into Perl code. This is about ten times slower than reusing an existing lump of code. So I need to somehow merge TT's providers with AxKit's providers so that caching works. Which should be fun. The second major issue is configuration. As far as I can see it atm, the configuration for things like INCLUDE_PATH that kip's already done is on a per server not per stylesheet basis (or perl Location block directive). I'm not sure what the right thing to do here is...I'll have to give it some thought.
Anyway, slowly but surely.
Re:I think there is one already
2shortplanks on 2004-08-15T09:04:17
Oh yes, they did make code that does this years ago, but it never got released. I wrote an improved version back in 2001, but never really got anywhere with that either. And I didn't commit it into a version control system (DOH!) so it's lost now.The new version uses Template::Plugin::XML::LibXML, which should be a lot quicker since it means you don't have to reparse the XML in the pnotes dom_tree if you've got one. And of course XML::LibXML's quicker and has better namespace support.