X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FReplicated%2FPool.pm;h=5bf61e6fe9bcfca94b8b00e5585dd146402c0bff;hb=de5dc9efd2c3575f78a7dc71c50d571c9a17c38d;hp=bba95d2a01ef3532481a9b9a5b0a5083e7eb525c;hpb=cb6ec758e3c4607ec8e30dd943a500a1d70d8940;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm index bba95d2..5bf61e6 100644 --- a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm @@ -36,7 +36,7 @@ has 'replicant_type' => ( is=>'ro', isa=>'ClassName', required=>1, - default=>'DBIx::Class::Storage::DBI::Replicated::Replicant', + default=>'DBIx::Class::Storage::DBI', handles=>{ 'create_replicant' => 'new', }, @@ -84,7 +84,7 @@ removes the replicant under $key from the pool has 'replicants' => ( is=>'rw', metaclass => 'Collection::Hash', - isa=>'HashRef[DBIx::Class::Storage::DBI::Replicated::Replicant]', + isa=>'HashRef[DBIx::Class::Storage::DBI]', default=>sub {{}}, provides => { 'set' => 'set_replicant', @@ -107,15 +107,21 @@ L attribute. =cut +use Data::Dump qw/dump/; + sub connect_replicants { my $self = shift @_; my $schema = shift @_; my @newly_created = (); foreach my $connect_info (@_) { + my $replicant = $self->create_replicant($schema); - $replicant->connect_info($connect_info); + $replicant->connect_info($connect_info); $replicant->ensure_connected; + + DBIx::Class::Storage::DBI::Replicated::Replicant->meta->apply($replicant); + my ($key) = ($connect_info->[0]=~m/^dbi\:.+\:(.+)$/); $self->set_replicant( $key => $replicant); push @newly_created, $replicant;