[CDBI] Class:DBI::Loader, Net::Daemon, threads and... ewww... :)

Mike Whitaker mike at mindcandydesign.com
Mon Sep 26 19:21:07 BST 2005


Here's one for you :)

Given a Net::Daemon daemon that basically talks to a DB, I'd  
obviously enough like Class::DBI::Loader to do the donkey work of  
reading in ****loads of tables just the once, not once per thread.

If I do that, and then hang the loader object off the Net::Daemon  
object such that each thread can fetch it, I get errors of the form:

DBD::mysql::db FETCH failed: handle 2 is owned by thread 814c008 not  
current thread 9698b50 (handles can't be shared between threads and  
your driver may need a CLONE method added) at /usr/share/perl5/Ima/ 
DBI.pm line 316, <GEN12> line 1.

OK. Fair enough. I'm probably being naughty. But is there a way of  
preserving the Class::DBI::Loader constructed relationships and  
hooking a new DBI handle on the back end?




More information about the ClassDBI mailing list