[Bast-commits] r6373 -
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Fri May 22 13:50:45 GMT 2009
Author: caelum
Date: 2009-05-22 13:50:45 +0000 (Fri, 22 May 2009)
New Revision: 6373
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Replicated.pm
Log:
::Replicated -- check for master rebless and reapply role if necessary
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Replicated.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Replicated.pm 2009-05-22 09:07:26 UTC (rev 6372)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Replicated.pm 2009-05-22 13:50:45 UTC (rev 6373)
@@ -324,6 +324,8 @@
around connect_info => sub {
my ($next, $self, $info, @extra) = @_;
+ my $wantarray = wantarray;
+
my %opts;
for my $arg (@$info) {
next unless (reftype($arg)||'') eq 'HASH';
@@ -357,7 +359,19 @@
$self->_master_connect_info_opts(\%opts);
- $self->$next($info, @extra);
+ my (@res, $res);
+ if ($wantarray) {
+ @res = $self->$next($info, @extra);
+ } else {
+ $res = $self->$next($info, @extra);
+ }
+
+ # May have to reapply role if master will be reblessed to a more specific
+ # driver.
+ $self->master->_determine_driver;
+ DBIx::Class::Storage::DBI::Replicated::WithDSN->meta->apply($self->master);
+
+ $wantarray ? @res : $res;
};
=head1 METHODS
More information about the Bast-commits
mailing list