[Catalyst] Template::Provider::DBI and Catalyst

Jess Robinson castaway at desert-island.demon.co.uk
Wed Feb 21 12:37:19 GMT 2007



On Tue, 13 Feb 2007, 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).

No idea what ForceUTF8 does, that seems a bit odd though.

> 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 :)

Patches welcome, I made it to scratch an itch, which it worked for, and 
that's as far as it got. (still waiting for cvs access from abw to merge 
with TT itself etc) I suspect to integrate with Catalyst/DBIC, you 
probably want to add a layer that uses it, and fetches the $dbh from DBIC, 
somehow.. shouldn't be too hard.

I'm too busy shaving other yaks to get back to that particular one. It's 
in the DBIC repo though, if you want to play.

> There's also an error message on every request:
>
> "prepare_cached(SELECT date_modified FROM templates
> WHERE filename = ?) statement handle DBI::st=HASH(0x91eac08) still Active"

Odd.. since it should only fetch one row at a time, there should be no 
need to call finish. But if that helps, send a patch ;)

> I assume this is because there is no $sth->finish() statement:
> http://search.cpan.org/~timb/DBI-1.53/DBI.pm#prepare_cached
>
> Thanks for any clarification!

Sorry for the delay, I don't read the cat list very often, try sending me 
an email directly next time?

Jess



More information about the Catalyst mailing list