From: Rafael Kitover Date: Wed, 26 Jan 2011 22:58:21 +0000 (-0500) Subject: turn relbuilder temp class cleanup back on, use Class::Inspector->loaded to check... X-Git-Tag: 0.07006~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c70d2c7f81d0a093bce7936293025d86321114c;p=dbsrgits%2FDBIx-Class-Schema-Loader.git turn relbuilder temp class cleanup back on, use Class::Inspector->loaded to check for class existance --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 649f037..a866f1b 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -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 diff --git a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm index 2023015..c4c198f 100644 --- a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm +++ b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm @@ -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;