[Bast-commits] r6121 - DBIx-Class/0.08/branches/storage-tweaks/lib/DBIx/Class/Storage/DBI/Replicated

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Mon May 4 18:07:47 GMT 2009


Author: caelum
Date: 2009-05-04 18:07:47 +0000 (Mon, 04 May 2009)
New Revision: 6121

Modified:
   DBIx-Class/0.08/branches/storage-tweaks/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
Log:
support hashrefs for connect_replicants

Modified: DBIx-Class/0.08/branches/storage-tweaks/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
===================================================================
--- DBIx-Class/0.08/branches/storage-tweaks/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm	2009-05-04 15:13:22 UTC (rev 6120)
+++ DBIx-Class/0.08/branches/storage-tweaks/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm	2009-05-04 18:07:47 UTC (rev 6121)
@@ -4,6 +4,7 @@
 use MooseX::AttributeHelpers;
 use DBIx::Class::Storage::DBI::Replicated::Replicant;
 use List::Util qw(sum);
+use Scalar::Util ();
 
 =head1 NAME
 
@@ -149,8 +150,15 @@
   
   my @newly_created = ();
   foreach my $connect_info (@_) {
+    $connect_info = [ $connect_info ]
+      if Scalar::Util::reftype($connect_info) ne 'ARRAY';
+
     my $replicant = $self->connect_replicant($schema, $connect_info);
-    my ($key) = ($connect_info->[0]=~m/^dbi\:.+\:(.+)$/);
+
+    my $key = $connect_info->[0];
+    $key = $key->{dsn} if Scalar::Util::reftype($key) eq 'HASH';
+    ($key) = ($key =~ m/^dbi\:.+\:(.+)$/);
+
     $self->set_replicant( $key => $replicant);  
     push @newly_created, $replicant;
   }




More information about the Bast-commits mailing list