[Catalyst] DBIC model and mpm_winnt threads in MP2.0 Engine

Ryan Parr ryan.catalyst at gmail.com
Wed Mar 8 19:54:24 CET 2006


On 3/7/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> Smells like it's trying to share the $dbh between threads. Try doing an
> explicit ->storage->disconnect after you've finished setting up, as
> documented at http://dev.catalyst.perl.org/wiki/SolvedIssues#si.85
>
> DBIx::Class can figure out it's not in the same process anymore and
> re-connect the $dbh but nobody's really looked into making the same
> thing work cross-thread - maybe that's because people are asking on the
> Catalyst list rather than the dbix-class list :)

Well, doing a little more research in this mailing list using
"disconnect" per Perrin's suggestion showed that the latest version of
DBIx::Class::Loader already does this. So I upgraded via CPAN because
the PPM repos aren't up to date. That solves this issue. I can no
longer pre-load my application, but that's nominal considering the
size and usage of this site.

Thank god too, because I couldn't figure out how to implement this in
the Catalyst framework. I converted my Catalyst::Model::DBIC base to a
DBIx::Class::Loader base per the example you pointed me at which
vaugely alludes to the situation I was seeing, but then nothing
worked. I lost all of the custom relationships etc. that I had setup.

Then I tried calling the line via package context in my base model. No
love. Tried in my root class, before and after __PACKAGE__->setup().
No love. Tried doing the whole thing in a startup.pl. No love. I'd
enjoy giving error messages, but all I get is "Can't load package"
from Apache. Damn this Win32 and its micro-managed buffers!

So, out of a simple fascination with the whole process I've just gone
through, how would someone do this in a Catalyst context (aside from
installing Linux:)? I'm sure it's a very simple solution, and quite
obvious once it's pointed out. I'm slow; I won't deny it. I should
probably be wearing a helmet most of the time. But the example you
point me at is specifically non-Catalyst. I've been going through
Catalyst and DBIC docs, but it's difficult to hold so many
semi-related bits'n'pieces from so many different pages together in my
brain long enough to wrap around it.

Hence the post to the Catalyst list :)

Thanks,
--
Ryan



More information about the Catalyst mailing list