From: Peter Rabbitson Date: Sun, 12 Sep 2010 18:49:06 +0000 (+0200) Subject: Add deprecation warning to DBIx::Class::ResultSetProxy X-Git-Tag: v0.08124~40 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=185bcdea3158aa51ff5d9d1e501ef4fce657766c;p=dbsrgits%2FDBIx-Class.git Add deprecation warning to DBIx::Class::ResultSetProxy --- diff --git a/lib/DBIx/Class/ResultSetProxy.pm b/lib/DBIx/Class/ResultSetProxy.pm index 56bb08d..48e17c4 100644 --- a/lib/DBIx/Class/ResultSetProxy.pm +++ b/lib/DBIx/Class/ResultSetProxy.pm @@ -1,6 +1,10 @@ package # hide from PAUSE DBIx::Class::ResultSetProxy; +unless ($INC{"DBIx/Class/DB.pm"}) { + warn "IMPORTANT: DBIx::Class::ResultSetProxy is DEPRECATED AND *WILL* BE REMOVED. DO NOT USE.\n"; +} + use strict; use warnings; diff --git a/t/30dbicplain.t b/t/30dbicplain.t index 9379e1c..736380e 100644 --- a/t/30dbicplain.t +++ b/t/30dbicplain.t @@ -1,19 +1,18 @@ use strict; use warnings; use Test::More; +use Test::Warn; use lib qw(t/lib); -plan tests => 3; +warnings_like { require DBICTest::Plain } + [ + qr/compose_connection deprecated as of 0\.08000/, + qr/\QDBIx::Class::ResultSetProxy is DEPRECATED/, + ], + 'no unexpected warnings' +; -my @warnings; - -{ - local $SIG{__WARN__} = sub { push(@warnings, $_[0]); }; - require DBICTest::Plain; -} - -like($warnings[0], qr/compose_connection deprecated as of 0\.08000/, - 'deprecation warning emitted ok'); -cmp_ok(@warnings, '==', 1, 'no unexpected warnings'); cmp_ok(DBICTest::Plain->resultset('Test')->count, '>', 0, 'count is valid'); + +done_testing; \ No newline at end of file