Class::C3::reinit changes backported from branch for speed reasons, version bumped...
Brandon Black [Tue, 21 Mar 2006 21:20:39 +0000 (21:20 +0000)]
Changes
META.yml
lib/DBIx/Class/Schema/Loader.pm
lib/DBIx/Class/Schema/Loader/Generic.pm

diff --git a/Changes b/Changes
index 8cea979..dfb8f49 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 Revision history for Perl extension DBIx::Class::Schema::Loader
 
+0.02007 Not yet released
+        - Backported Class::C3::reinitialize changes from branch,
+          resulting in significantly reduced load time
+
 0.02006 Fri Mar 17 04:55:55 UTC 2006
         - Fix long-standing table/col-name case bugs
 
index 170818b..3bfd22d 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,6 +1,6 @@
 ---
 name: DBIx-Class-Schema-Loader
-version: 0.02006
+version: 0.02007
 author:
   - 'Brandon Black, C<blblack@gmail.com>'
 abstract: Dynamic definition of a DBIx::Class::Schema
@@ -20,7 +20,7 @@ build_requires:
 provides:
   DBIx::Class::Schema::Loader:
     file: lib/DBIx/Class/Schema/Loader.pm
-    version: 0.02006
+    version: 0.02007
   DBIx::Class::Schema::Loader::DB2:
     file: lib/DBIx/Class/Schema/Loader/DB2.pm
   DBIx::Class::Schema::Loader::Generic:
@@ -33,4 +33,4 @@ provides:
     file: lib/DBIx/Class/Schema/Loader/Writing.pm
   DBIx::Class::Schema::Loader::mysql:
     file: lib/DBIx/Class/Schema/Loader/mysql.pm
-generated_by: Module::Build version 0.2612
+generated_by: Module::Build version 0.2611
index 20b014a..aa62e41 100644 (file)
@@ -10,7 +10,7 @@ use UNIVERSAL::require;
 # Always remember to do all digits for the version even if they're 0
 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
 # brain damage and presumably various other packaging systems too
-our $VERSION = '0.02006';
+our $VERSION = '0.02007';
 
 __PACKAGE__->mk_classaccessor('loader');
 
index 5112862..b9ff28e 100644 (file)
@@ -380,7 +380,6 @@ sub _load_classes {
     $self->{_tables} = \@tables;
 
     foreach my $table (@tables) {
-
         my ($db_schema, $tbl) = split /\./, $table;
         if($tbl) {
             $table = $self->drop_db_schema ? $tbl : $table;
@@ -390,6 +389,15 @@ sub _load_classes {
         my $table_moniker = $self->_table2moniker($db_schema, $tbl);
         my $table_class = $schema . q{::} . $table_moniker;
 
+        $self->classes->{$lc_table} = $table_class;
+        $self->monikers->{$lc_table} = $table_moniker;
+        $self->classes->{$table} = $table_class;
+        $self->monikers->{$table} = $table_moniker;
+
+        no warnings 'redefine';
+        local *Class::C3::reinitialize = sub { };
+        use warnings;
+
         { no strict 'refs';
           @{"${table_class}::ISA"} = qw/DBIx::Class/;
         }
@@ -399,6 +407,13 @@ sub _load_classes {
         $table_class->load_resultset_components(@{$self->resultset_components})
             if @{$self->resultset_components};
         $self->_inject($table_class, @{$self->left_base_classes});
+    }
+
+    Class::C3::reinitialize;
+
+    foreach my $table (@tables) {
+        my $table_class = $self->classes->{$table};
+        my $table_moniker = $self->monikers->{$table};
 
         warn qq/\# Initializing table "$table" as "$table_class"\n/
             if $self->debug;
@@ -417,10 +432,6 @@ sub _load_classes {
             if $self->debug && @$pks;
 
         $schema->register_class($table_moniker, $table_class);
-        $self->classes->{$lc_table} = $table_class;
-        $self->monikers->{$lc_table} = $table_moniker;
-        $self->classes->{$table} = $table_class;
-        $self->monikers->{$table} = $table_moniker;
     }
 }