From: Dagfinn Ilmari Mannsåker Date: Sun, 1 Jun 2008 00:29:08 +0000 (+0000) Subject: Neuter Class::C3::reinitialize() around the schema reloading. X-Git-Tag: 0.04999_06~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0ae6b65d0f53de08a9c7e2494654391a06170cbc;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Neuter Class::C3::reinitialize() around the schema reloading. We're not changing any inheritance here, and this is equivalent to what the old code did around _make_src_class(). --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index a78ba9e..25ae429 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -412,13 +412,19 @@ sub _reload_classes { 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 ) - if $resultset_class ne 'DBIx::Class::ResultSet'; + + { + no warnings 'redefine'; + local *Class::C3::reinitialize = sub {}; + use warnings; + + if ( Class::Unload->unload( $class ) ) { + my $resultset_class = ref $self->schema->resultset($moniker); + Class::Unload->unload( $resultset_class ) + if $resultset_class ne 'DBIx::Class::ResultSet'; + } + $class->require or die "Can't load $class: $@"; } - $class->require or die "Can't load $class: $@"; $self->schema_class->register_class($moniker, $class); $self->schema->register_class($moniker, $class)