From: Rafael Kitover Date: Thu, 24 Dec 2009 06:49:54 +0000 (+0000) Subject: replacing ::Base with ::Compat now, instead of just unshifting to @ISA, t/backcompat... X-Git-Tag: 0.04999_13~23^2~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=254ba31ccf3d09c814e8267019b00775878347e5;hp=1c95b304b7122906e73de27b72b7cf9fa76bc475;p=dbsrgits%2FDBIx-Class-Schema-Loader.git replacing ::Base with ::Compat now, instead of just unshifting to @ISA, t/backcompat/0.04006/20invocations.t now passes --- diff --git a/TODO-BACKCOMPAT b/TODO-BACKCOMPAT index 08b4a54..5b50091 100644 --- a/TODO-BACKCOMPAT +++ b/TODO-BACKCOMPAT @@ -14,13 +14,9 @@ SL Backcompat Plan: *** backcompat tests These are still failing: -* t/backcompat/0.04006/20invocations.t * t/backcompat/0.04006/23dumpmore.t -*** naming accessor - -* class data for Loader -* passed to _loader->new +Need a comprehensive backcompat.t *** Write ::Manual::UpgradingFrom0.04006 POD diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 64a9a6c..141643c 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -343,8 +343,13 @@ sub _check_back_compat { no strict 'refs'; my $class = ref $self || $self; require DBIx::Class::Schema::Loader::Compat::v0_040; - unshift @{"${class}::ISA"}, - 'DBIx::Class::Schema::Loader::Compat::v0_040'; + + @{"${class}::ISA"} = map { + $_ eq 'DBIx::Class::Schema::Loader::Base' ? + 'DBIx::Class::Schema::Loader::Compat::v0_040' : + $_ + } @{"${class}::ISA"}; + Class::C3::reinitialize; # just in case, though no one is likely to dump a dynamic schema $self->schema_version_to_dump('0.04006'); @@ -367,7 +372,12 @@ sub _check_back_compat { if ($self->load_optional_class($compat_class)) { no strict 'refs'; my $class = ref $self || $self; - unshift @{"${class}::ISA"}, $compat_class; + + @{"${class}::ISA"} = map { + $_ eq 'DBIx::Class::Schema::Loader::Base' ? + $compat_class : $_ + } @{"${class}::ISA"}; + Class::C3::reinitialize; $self->schema_version_to_dump($real_ver); last; diff --git a/lib/DBIx/Class/Schema/Loader/Compat/v0_040.pm b/lib/DBIx/Class/Schema/Loader/Compat/v0_040.pm index 63dd8db..1af1647 100644 --- a/lib/DBIx/Class/Schema/Loader/Compat/v0_040.pm +++ b/lib/DBIx/Class/Schema/Loader/Compat/v0_040.pm @@ -3,6 +3,9 @@ package DBIx::Class::Schema::Loader::Compat::v0_040; use strict; use warnings; use Class::C3; + +use base 'DBIx::Class::Schema::Loader::Base'; + use DBIx::Class::Schema::Loader::RelBuilder::Compat::v0_040; # Make a moniker from a table