use strict;
package MyClass;
use base 'Class::DBI';
__PACKAGE__->set_db('Main','dbi:mysql:test', 'test','test');
__PACKAGE__->table('MYCLASS');
__PACKAGE__->columns(Primary=>qw/ID/);
__PACKAGE__->columns(Others => qw/NAME/);
package main;
use threads;
my $s = MyClass->retrieve(1);
threads->new(\&test, $s)->join();
print "done\n";
exit 0;
sub test{
my $o = shift;
print $o->name,"\n";
}
####
thread failed to start: DBD::mysql::db FETCH failed: handle 2 is owned by thread 22432c not current thread 1b1e014(handles can't be shared between threads and your driver may need a CLONE method added) at C:/Perl/site/lib/Ima/DBI.pm line 316.
Attempt to free non-existent shared string 'test~~test~~test~~AutoCommit~~ChopBlanks~~FetchHashKeyName~~PrintError~~RaiseError~~RootClass~~ShowErrorStatement~~Taint~~Username~~dbi_connect_method~~1~~1~~NAME_lc~~0~~1~~DBIx::ContextualFetch~~1~~1~~test~~connect_cached' during global destruction.
Free to wrong pool 1b24430 not 222770 during global destruction.
####
sub _mk_db_closure {
my ($class, @connection) = @_;
my $dbh;
return sub {
unless ($dbh && $dbh->FETCH('Active') && $dbh->ping) {
$dbh = DBI->connect_cached(@connection);
}
return $dbh;
};
}