[Bast-commits] r4414 -
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader
ilmari at dev.catalyst.perl.org
ilmari at dev.catalyst.perl.org
Tue May 27 02:20:13 BST 2008
Author: ilmari
Date: 2008-05-27 02:20:12 +0100 (Tue, 27 May 2008)
New Revision: 4414
Modified:
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
Log:
Move the _dump_to_dir calls into _reload_classes
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2008-05-26 17:22:12 UTC (rev 4413)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2008-05-27 01:20:12 UTC (rev 4414)
@@ -385,14 +385,10 @@
$self->_make_src_class($_) for @tables;
$self->_setup_src_meta($_) for @tables;
- my %moniker_class = map { $self->monikers->{$_} => $self->classes->{$_} } @tables;
-
if(!$self->skip_relationships) {
- # Dump and load what we have so far, so the relationship loader
- # can get at it, but be quiet
+ # The relationship loader needs a working schema
$self->{quiet} = 1;
- $self->_dump_to_dir(values %moniker_class);
- $self->_reload_classes(\%moniker_class);
+ $self->_reload_classes(@tables);
$self->_load_relationships($_) for @tables;
$self->{quiet} = 0;
}
@@ -400,11 +396,8 @@
$self->_load_external($_)
for map { $self->classes->{$_} } @tables;
- $self->_dump_to_dir(values %moniker_class);
+ $self->_reload_classes(@tables);
- # Make sure stuff gets reloaded
- $self->_reload_classes(\%moniker_class);
-
# Drop temporary cache
delete $self->{_cache};
@@ -412,9 +405,14 @@
}
sub _reload_classes {
- my ($self, $moniker_class) = @_;
+ my ($self, @tables) = @_;
+
+ $self->_dump_to_dir(map { $self->classes->{$_} } @tables);
- while (my ($moniker, $class) = each %$moniker_class) {
+ for my $table (@tables) {
+ my $moniker = $self->monikers->{$table};
+ my $class = $self->classes->{$table};
+
if ( Class::Unload->unload( $class ) ) {
my $resultset_class = ref $self->schema->resultset($moniker);
Class::Unload->unload( $resultset_class )
More information about the Bast-commits
mailing list