On Tue, Feb 13, 2007 at 11:02:21AM +0100, Tobias Kremer wrote: > Following up on a recent post to the list concerning templates in the database > I'm wondering what the current status of Template::Provider::DBI is and if > anyone is using it in production within Catalyst? I just found out that it > seems to be incompatible with Catalyst::View::TT::ForceUTF8, for example > (ForceUTF8 seems to ignore LOAD_TEMPLATES. Haven't looked at its source code > yet to tell what's going on).
I'm using Postgresql and the DBD sets the utf8 flag, and I explicitly decode_utf8 when needed so I have not found that I needed to use ForceUTF8. > Looking at the source of Template::Provider::DBI I see that the database > handle > is stored within the object which AFAIK is created once during server start by > my View class initialization. I was told that storing database handles in > objects for subsequent queries should be avoided by any means. Of course it > could just be me who got burnt doing this under mod_perl :) Plus, you won't know if the handle is re-created at some point. I'm using CDBI so I get my handle from my model class each time I fetch from the database. What I wanted is an easy way to override Template::Provider -- where the provider would still provide all the normal features and caching but just allow me to specify a different template store. I did this by adding two methods _template_mtime() to get the last modified time of the template, and _fetch_content() to, well, fetch the template content. So I have an App::Template::Provider that overrides the default Provider and just includes those two methods. Adding those two methods required a bit of rewriting of Template::Provider so I now have my own Template::Provider in keep in my App's lib directory: http://hank.org/Provider.pm http://hank.org/Provider.diff (against cvs two days ago) Should be a drop-in replacement for the default provider. -- Bill Moseley [EMAIL PROTECTED] _______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/