Carl Johnstone wrote:
Have you copied the example code from DBD::Multiplex?
%attr = (
'mx_dsns' => [$dsn1, $dsn2, $dsn3, $dsn4],
'mx_master_id' => 'dbaaa1',
'mx_connect_mode' => 'ignore_errors',
'mx_exit_mode' => 'first_success',
'mx_error_proc' => \&MyErrorProcedure,
);
$dbh = DBI->connect("dbi:Multiplex:", 'username', 'password', \%attr);
If so you're creating a NEW anonymous array everytime you build %attr. Try:
my @dsns = ($dsn1, $dsn2, $dsn3, $dsn4); %attr = ( 'mx_dsns' =>
[EMAIL PROTECTED], 'mx_master_id' => 'dbaaa1', 'mx_connect_mode'
=>
'ignore_errors', 'mx_exit_mode' => 'first_success',
'mx_error_proc' => \&MyErrorProcedure, ); $dbh =
DBI->connect("dbi:Multiplex:", 'username', 'password', \%attr); Or even
better find someway of defining this stuff once, then re-using it. I'd
suggest a custom DB settings module then when loaded initialises the
required variables, and can return a DB handle to any other code when you
need it.Carl
Hello Carl,
Thanks for the suggestion. It appears that DBD::Multiplex is mashing up
the ref address each time. Interesting its not mashing up the sub ref
address for mx_error_proc. I'll dig deaper into Multiplex and see why
its changing it.
Regards,
Pierre