[Bast-commits] r5902 - in DBIx-Class/0.08/trunk: lib/DBIx
lib/DBIx/Class t
ilmari at dev.catalyst.perl.org
ilmari at dev.catalyst.perl.org
Sat Apr 18 18:38:45 GMT 2009
Author: ilmari
Date: 2009-04-18 19:38:44 +0100 (Sat, 18 Apr 2009)
New Revision: 5902
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
DBIx-Class/0.08/trunk/t/100extra_source.t
Log:
Don't warn when reregistering a source under the same name
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2009-04-18 13:30:49 UTC (rev 5901)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2009-04-18 18:38:44 UTC (rev 5902)
@@ -1279,7 +1279,8 @@
if ($source->result_class) {
my %map = %{$self->class_mappings};
- if (exists $map{$source->result_class}) {
+ if (exists $map{$source->result_class}
+ && $map{$source->result_class} ne $moniker) {
warn $source->result_class . ' already has a source, use register_extra_source for additional sources';
}
$map{$source->result_class} = $moniker;
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class.pm 2009-04-18 13:30:49 UTC (rev 5901)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class.pm 2009-04-18 18:38:44 UTC (rev 5902)
@@ -241,6 +241,8 @@
groditi: Guillermo Roditi <groditi at cpan.org>
+ilmari: Dagfinn Ilmari MannsE<aring>ker <ilmari at ilmari.org>
+
jesper: Jesper Krogh
jgoulah: John Goulah <jgoulah at cpan.org>
Modified: DBIx-Class/0.08/trunk/t/100extra_source.t
===================================================================
--- DBIx-Class/0.08/trunk/t/100extra_source.t 2009-04-18 13:30:49 UTC (rev 5901)
+++ DBIx-Class/0.08/trunk/t/100extra_source.t 2009-04-18 18:38:44 UTC (rev 5902)
@@ -12,7 +12,7 @@
use base qw/DBIx::Class::ResultSource::Table/;
}
-plan tests => 3;
+plan tests => 4;
my $schema = DBICTest->init_schema();
my $artist_source = $schema->source('Artist');
@@ -36,6 +36,12 @@
}
{
+ 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");
+}
+
+{
my $new_source_name = 'Artist->preview(artist_preview)';
$schema->register_source( $new_source_name => $new_source );
More information about the Bast-commits
mailing list