From: Jason M. Mills Date: Wed, 17 Dec 2008 06:13:07 +0000 (+0000) Subject: A simple fix to the warning generated by a sub-classed proxy - Please verify. X-Git-Tag: v0.08240~91^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1a304e513dc3fb708512877ab25423b567e1bedc;p=dbsrgits%2FDBIx-Class.git A simple fix to the warning generated by a sub-classed proxy - Please verify. --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index a65c0a9..849f1dd 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -208,6 +208,7 @@ sub load_namespaces { local *Class::C3::reinitialize = sub { }; use warnings 'redefine'; + my %done; foreach my $result (keys %results) { my $result_class = $results{$result}; $class->ensure_class_loaded($result_class); @@ -215,8 +216,9 @@ sub load_namespaces { my $rs_class = delete $resultsets{$result}; my $rs_set = $result_class->resultset_class; + $done{$rs_set} = $rs_set unless exists $done{$rs_set}; if($rs_set && $rs_set ne 'DBIx::Class::ResultSet') { - if($rs_class && $rs_class ne $rs_set) { + if($rs_class && !exists($done{$rs_set}) && $rs_class ne $rs_set) { warn "We found ResultSet class '$rs_class' for '$result', but it seems " . "that you had already set '$result' to use '$rs_set' instead"; } diff --git a/t/39load_namespaces_rt41083.t b/t/39load_namespaces_rt41083.t index 88fd6b7..ba99fe5 100644 --- a/t/39load_namespaces_rt41083.t +++ b/t/39load_namespaces_rt41083.t @@ -6,7 +6,7 @@ use Test::More; use lib 't/lib'; -plan tests => 2; +plan tests => 4; sub _chk_warning { defined $_[0]? @@ -26,7 +26,7 @@ eval { ); }; ok(!$@) or diag $@; -ok(_chk_warning($warnings), 'Works here'); +ok(_chk_warning($warnings), 'expected no complaint'); eval { local $SIG{__WARN__} = sub { $warnings .= shift }; @@ -39,4 +39,4 @@ eval { ); }; ok(!$@) or diag $@; -ok(_chk_warning($warnings), 'Fails here'); +ok(_chk_warning($warnings), 'expected no complaint') or diag $warnings; diff --git a/t/lib/DBICNSTest/RtBug41083/ResultSet/Foo.pm b/t/lib/DBICNSTest/RtBug41083/ResultSet/Foo.pm index f0731c3..9bf912a 100644 --- a/t/lib/DBICNSTest/RtBug41083/ResultSet/Foo.pm +++ b/t/lib/DBICNSTest/RtBug41083/ResultSet/Foo.pm @@ -2,4 +2,7 @@ package DBICNSTest::RtBug41083::ResultSet::Foo; use strict; use warnings; use base 'DBICNSTest::RtBug41083::ResultSet'; + +sub fooBar { 1; } + 1; diff --git a/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm b/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm index a0264c6..cb93955 100644 --- a/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm +++ b/t/lib/DBICNSTest/RtBug41083/ResultSet_A/A.pm @@ -2,4 +2,6 @@ package DBICNSTest::RtBug41083::ResultSet_A::A; use strict; use warnings; use base 'DBICNSTest::RtBug41083::ResultSet'; + +sub fooBar { 1; } 1;