moved $target::schema definition from compose_namespace() to compose_connection()
Brandon L. Black [Wed, 1 Feb 2006 04:26:48 +0000 (04:26 +0000)]
lib/DBIx/Class/Schema.pm

index 59fca81..b3f8330 100644 (file)
@@ -247,6 +247,11 @@ sub compose_connection {
   }
 
   my $schema = $self->compose_namespace($target, $base);
+  {
+    no strict 'refs';
+    *{"${target}::schema"} = sub { $schema };
+  }
+
   $schema->connection(@info);
   foreach my $moniker ($schema->sources) {
     my $source = $schema->source($moniker);
@@ -275,8 +280,6 @@ sub compose_namespace {
   }
   {
     no strict 'refs';
-    *{"${target}::schema"} =
-      sub { $schema };
     foreach my $meth (qw/class source resultset/) {
       *{"${target}::${meth}"} =
         sub { shift->schema->$meth(@_) };