From: Matt S Trout Date: Thu, 18 May 2006 17:36:48 +0000 (+0000) Subject: Moved PK::Auto into core X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eb47985e6ccf89ec6433257852505c1a8e160303;p=dbsrgits%2FDBIx-Class-Historic.git Moved PK::Auto into core --- diff --git a/lib/DBIx/Class/Componentised.pm b/lib/DBIx/Class/Componentised.pm index 7e62354..560c374 100644 --- a/lib/DBIx/Class/Componentised.pm +++ b/lib/DBIx/Class/Componentised.pm @@ -10,11 +10,10 @@ sub inject_base { my ($class, $target, @to_inject) = @_; { no strict 'refs'; - my %seen; - unshift( @{"${target}::ISA"}, - grep { !$seen{ $_ }++ && $target ne $_ && !$target->isa($_) } - @to_inject - ); + foreach my $to (reverse @to_inject) { + unshift( @{"${target}::ISA"}, $to ) + unless ($target eq $to || $target->isa($to)); + } } # Yes, this is hack. But it *does* work. Please don't submit tickets about diff --git a/lib/DBIx/Class/Core.pm b/lib/DBIx/Class/Core.pm index 96a6a9a..87e7dce 100644 --- a/lib/DBIx/Class/Core.pm +++ b/lib/DBIx/Class/Core.pm @@ -10,6 +10,7 @@ __PACKAGE__->load_components(qw/ Serialize::Storable InflateColumn Relationship + PK::Auto PK Row ResultSourceProxy::Table diff --git a/lib/DBIx/Class/Test/SQLite.pm b/lib/DBIx/Class/Test/SQLite.pm index 72a3c10..3302289 100644 --- a/lib/DBIx/Class/Test/SQLite.pm +++ b/lib/DBIx/Class/Test/SQLite.pm @@ -35,7 +35,7 @@ use warnings; use base qw/DBIx::Class/; -__PACKAGE__->load_components(qw/PK::Auto CDBICompat Core DB/); +__PACKAGE__->load_components(qw/CDBICompat Core DB/); use File::Temp qw/tempfile/; my (undef, $DB) = tempfile(); diff --git a/t/05components.t b/t/05components.t index fd0742f..4b063bf 100644 --- a/t/05components.t +++ b/t/05components.t @@ -15,6 +15,9 @@ ok( DBICTest::ForeignComponent->foreign_test_method, 'foreign component' ); # Test for inject_base to filter out duplicates { package DBICTest::_InjectBaseTest; use base qw/ DBIx::Class /; + package DBICTest::_InjectBaseTest::A; + package DBICTest::_InjectBaseTest::B; + package DBICTest::_InjectBaseTest::C; } DBICTest::_InjectBaseTest->inject_base( 'DBICTest::_InjectBaseTest', qw/ DBICTest::_InjectBaseTest::A