[Catalyst-commits] r12605 - in Catalyst-Runtime/5.80/trunk: . lib/Catalyst t/aggregate

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Mon Jan 11 21:11:05 GMT 2010


Author: t0m
Date: 2010-01-11 21:11:05 +0000 (Mon, 11 Jan 2010)
New Revision: 12605

Added:
   Catalyst-Runtime/5.80/trunk/t/aggregate/deprecated_test_import.t
Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Test.pm
Log:
Deprecate bare imports of Catalyst::Test - either use an app name or don't run the import method. As-per r12564

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2010-01-11 14:53:11 UTC (rev 12604)
+++ Catalyst-Runtime/5.80/trunk/Changes	2010-01-11 21:11:05 UTC (rev 12605)
@@ -3,6 +3,11 @@
   Documentation:
    - Clarify that uri_for_action works on private paths, with example.
 
+  Deprecations:
+   - Saying use Catalyst::Test; (without an application name or () to stop
+     the importer running is now deprecated and will issue a warning.
+     You should be saying use Catalyst::Test ();
+
 5.80017 2010-01-10 02:27:29
 
   Documentation:

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Test.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Test.pm	2010-01-11 14:53:11 UTC (rev 12604)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Test.pm	2010-01-11 21:11:05 UTC (rev 12605)
@@ -103,6 +103,12 @@
 
     sub import {
         my ($self, $class, $opts) = @_;
+        Carp::carp(
+qq{Importing Catalyst::Test without an application name is deprecated:\n
+Instead of saying: use Catalyst::Test;
+say: use Catalyst::Test (); # If you don't want to import a test app right now.
+or say: use Catalyst::Test 'MyApp'; # If you do want to import a test app.\n\n})
+        unless $class;
         $import->($self, '-all' => { class => $class });
         $opts = {} unless ref $opts eq 'HASH';
         $default_host = $opts->{default_host} if exists $opts->{default_host};

Added: Catalyst-Runtime/5.80/trunk/t/aggregate/deprecated_test_import.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/deprecated_test_import.t	                        (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/deprecated_test_import.t	2010-01-11 21:11:05 UTC (rev 12605)
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Catalyst::Test ();
+
+my $warn;
+{
+    local $SIG{__WARN__} = sub { $warn = shift; };
+    Catalyst::Test->import();
+}
+ok $warn;
+like $warn, qr/deprecated/;
+
+done_testing;
+




More information about the Catalyst-commits mailing list