turn relbuilder temp class cleanup back on, use Class::Inspector->loaded to check...
Rafael Kitover [Wed, 26 Jan 2011 22:58:21 +0000 (17:58 -0500)]
lib/DBIx/Class/Schema/Loader/Base.pm
lib/DBIx/Class/Schema/Loader/RelBuilder.pm

index 649f037..a866f1b 100644 (file)
@@ -1069,7 +1069,7 @@ sub _load_tables {
         local $self->{dump_directory} = $self->{temp_directory};
         $self->_reload_classes(\@tables);
         $self->_load_relationships($_) for @tables;
-#        $self->_relbuilder->cleanup; # this breaks perl 5.8.x
+        $self->_relbuilder->cleanup;
         $self->{quiet} = 0;
 
         # Remove that temp dir from INC so it doesn't get reloaded
index 2023015..c4c198f 100644 (file)
@@ -11,6 +11,7 @@ use DBIx::Class::Schema::Loader::Utils 'split_name';
 use File::Slurp 'slurp';
 use Try::Tiny;
 use Class::Unload ();
+use Class::Inspector ();
 use List::MoreUtils 'apply';
 use namespace::clean;
 
@@ -421,7 +422,7 @@ sub _relnames_and_method {
         if (-f (my $existing_remote_file = $self->base->get_dump_filename($remote_class))) {
             my $class = "${remote_class}Temporary";
 
-            if (not do { no strict 'refs'; %{$class . '::'} }) {
+            if (not Class::Inspector->loaded($class)) {
                 my $code = slurp $existing_remote_file;
 
                 $code =~ s/(?<=package $remote_class)/Temporary/g;