From: Rafael Kitover Date: Sat, 13 Jun 2009 23:20:02 +0000 (+0000) Subject: fix master debug output for ::Replicated X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fd4eb9c201f606da4a51190753d4f12e73db3df0;p=dbsrgits%2FDBIx-Class-Historic.git fix master debug output for ::Replicated --- diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm index 259cdc5..731e16a 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm @@ -366,10 +366,11 @@ around connect_info => sub { $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); + # Make sure master is blessed into the correct class and apply role to it. + my $master = $self->master; + $master->_determine_driver; + Moose::Meta::Class->initialize(ref $master); + DBIx::Class::Storage::DBI::Replicated::WithDSN->meta->apply($master); $wantarray ? @res : $res; }; @@ -405,7 +406,6 @@ Lazy builder for the L attribute. sub _build_master { my $self = shift @_; my $master = DBIx::Class::Storage::DBI->new($self->schema); - DBIx::Class::Storage::DBI::Replicated::WithDSN->meta->apply($master); $master }