eliminate the last of the AutoCommit warnings
Matt S Trout [Fri, 11 May 2007 03:54:27 +0000 (03:54 +0000)]
lib/DBIx/Class/Schema.pm
lib/DBIx/Class/Storage/DBI.pm
t/lib/DBICTest.pm

index 223dbd3..b1fa17f 100644 (file)
@@ -503,7 +503,8 @@ more information.
   sub compose_connection {
     my ($self, $target, @info) = @_;
 
-    warn "compose_connection deprecated as of 0.08000" unless $warn++;
+    warn "compose_connection deprecated as of 0.08000"
+      unless ($INC{"DBIx/Class/CDBICompat.pm"} || $warn++);
 
     my $base = 'DBIx::Class::ResultSetProxy';
     eval "require ${base};";
index 067a47a..33adf88 100644 (file)
@@ -486,7 +486,6 @@ sub connect_info {
   #  but not in the coderef case, obviously.
   if(ref $info->[0] ne 'CODE') {
       $last_info = $info->[3];
-
       warn "You *really* should explicitly set AutoCommit "
          . "(preferably to 1) in your db connect info"
            if !$last_info
index 8f1521c..5e518b1 100755 (executable)
@@ -55,12 +55,18 @@ sub init_schema {
     my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
     my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
 
-    my $compose_method = ($args{compose_connection}
-                           ? 'compose_connection'
-                           : 'compose_namespace');
+    my $schema;
 
-    my $schema = DBICTest::Schema->$compose_method('DBICTest')
-                     ->connect($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+    my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+
+    if ($args{compose_connection}) {
+      $schema = DBICTest::Schema->compose_connection(
+                  'DBICTest', @connect_info
+                );
+    } else {
+      $schema = DBICTest::Schema->compose_namespace('DBICTest')
+                                ->connect(@connect_info);
+    }
     $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
     if ( !$args{no_deploy} ) {
         __PACKAGE__->deploy_schema( $schema );