Hi, Is there anything special a subclassed DBI module (DBIx::Log4perl in this case) needs to do for the clone method?
The DBI docs currently say "The clone method duplicates the $dbh connection by connecting with the same parameters ($dsn, $user, $password) as originally used." but I don't see any call to connect when clone is called. I presume there is something I need to do - any ideas? e.g., the following code: use strict; use warnings; use DBI; use Proc::Fork; use Data::Dumper; Log::Log4perl->init_and_watch('fork.conf', 60); my $ph = DBIx::Log4perl->connect( "dbi:Oracle:host=xxx;sid=devel", "xxx", "xxx"); print "ph InactiveDestroy = $ph->{InactiveDestroy}\n"; print Data::Dumper->Dump( $ph->selectall_arrayref(q/select 1 from dual/), [qw(ph_before_fork)]); run_fork { child { my $ch = $ph->clone; $ph->{InactiveDestroy} = 1; $ph = undef; print Data::Dumper->Dump( $ch->selectall_arrayref(q/select 1 from dual/), [qw(ch)]); exit 0; } parent { my $child_pid = shift; print Data::Dumper->Dump( $ph->selectall_arrayref( q/select 1 from dual/), [qw(ph_before_wait)]); waitpid $child_pid, 0; } }; print Data::Dumper->Dump( $ph->selectall_arrayref( q/select 1 from dual/), [qw(ph_after_child_dies)]); causes output of: $ perl fork.pl ph InactiveDestroy = $ph_before_fork = [ '1' ]; $ph_before_wait = [ '1' ]; Use of uninitialized value in bitwise and (&) at /usr/local/share/perl/5.10.0/DBIx/Log4perl/db.pm line 182. Use of uninitialized value in subroutine entry at /usr/local/share/perl/5.10.0/DBIx/Log4perl/db.pm line 40. Can't use string ("") as a subroutine ref while "strict refs" in use at /usr/local/share/perl/5.10.0/DBIx/Log4perl/db.pm line 40. $ph_after_child_dies = [ '1' ]; and Log::Log4perl output of: 2010/01/19 20:46:45 DEBUG> fork.pl:14 main:: - connect(0): dbi:Oracle:host=xxx;sid=devel, xxx 2010/01/19 20:46:45 INFO> fork.pl:14 main:: - DBI: 1.609, DBIx::Log4perl: 0.18, Driver: Oracle(1.23) 2010/01/19 20:46:45 DEBUG> fork.pl:20 main:: - selectall_arrayref(0): 'select 1 from dual' 2010/01/19 20:46:45 DEBUG> fork.pl:42 main::__ANON__ - selectall_arrayref(0): 'select 1 from dual' 2010/01/19 20:46:45 DEBUG> fork.pl:34 main::__ANON__ - $STORE(0) = ['InactiveDestroy',1]; 2010/01/19 20:46:45 DEBUG> fork.pl:49 main:: - selectall_arrayref(0): 'select 1 from dual' If I change the code to connect again in the child instead of using clone the Log::Log4perl output is: 2010/01/19 20:56:38 DEBUG> fork.pl:14 main:: - connect(0): dbi:Oracle:host=xxx;sid=devel, xxx 2010/01/19 20:56:38 INFO> fork.pl:14 main:: - DBI: 1.609, DBIx::Log4perl: 0.18, Driver: Oracle(1.23) 2010/01/19 20:56:38 DEBUG> fork.pl:20 main:: - selectall_arrayref(0): 'select 1 from dual' 2010/01/19 20:56:38 DEBUG> fork.pl:42 main::__ANON__ - selectall_arrayref(0): 'select 1 from dual' 2010/01/19 20:56:38 DEBUG> fork.pl:30 main::__ANON__ - connect(1): dbi:Oracle:host=xxx;sid=devel, xxx Notice the second connect above ^ 2010/01/19 20:56:38 INFO> fork.pl:30 main::__ANON__ - DBI: 1.609, DBIx::Log4perl: 0.18, Driver: Oracle(1.23) 2010/01/19 20:56:38 DEBUG> fork.pl:34 main::__ANON__ - $STORE(0) = ['InactiveDestroy',1]; 2010/01/19 20:56:38 DEBUG> fork.pl:36 main::__ANON__ - selectall_arrayref(1): 'select 1 from dual' 2010/01/19 20:56:38 DEBUG> fork.pl:49 main:: - selectall_arrayref(0): 'select 1 from dual' and it all works fine. I'd be grateful for any pointers. Martin