around connect_info => sub {
my ($next, $self, $info, @extra) = @_;
+ my $wantarray = wantarray;
+
my %opts;
for my $arg (@$info) {
next unless (reftype($arg)||'') eq 'HASH';
$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