From: Peter Rabbitson Date: Tue, 21 Apr 2009 11:06:25 +0000 (+0000) Subject: Sloppy merge - adding imlari's fix from r5902 X-Git-Tag: v0.08101~12^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f18d2d041d8a6c36a1d87a75f8531ee2f59940b5;p=dbsrgits%2FDBIx-Class.git Sloppy merge - adding imlari's fix from r5902 --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index aa32f25..2f85adb 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -1283,7 +1283,13 @@ sub _register_source { return if ($params->{extra}); my %map = %{$self->class_mappings}; - if (exists $map{$rs_class} and $rs_class->result_source_instance ne $orig_source) { + if ( + exists $map{$rs_class} + and + $map{$rs_class} ne $moniker + and + $rs_class->result_source_instance ne $orig_source + ) { carp "$rs_class already has a source, use register_extra_source for additional sources"; } $map{$rs_class} = $moniker; diff --git a/t/100extra_source.t b/t/100extra_source.t index c5c19bb..05d99b9 100644 --- a/t/100extra_source.t +++ b/t/100extra_source.t @@ -38,7 +38,7 @@ local $SIG{__WARN__} = sub { $warn = shift }; { my $source = $schema->source('DBICTest::Artist'); $schema->register_source($source->source_name, $source); - is($warn, '', "regregistering an existing source under the same name causes no errors"); + is($warn, '', "re-registering an existing source under the same name causes no errors"); } {