[Jifty-commit] jifty branch, master, updated. 03f210101db29c204d973da2ea0c7545747e470f

Jifty commits jifty-commit at lists.jifty.org
Thu Dec 9 13:07:23 EST 2010


The branch, master has been updated
       via  03f210101db29c204d973da2ea0c7545747e470f (commit)
      from  c55221f1a4d4bc8ebd60b74e860ec44d4da63feb (commit)

Summary of changes:
 Makefile.PL                   |    1 +
 lib/Jifty/Test/WWW/Declare.pm |   21 ++++++++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 03f210101db29c204d973da2ea0c7545747e470f
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Dec 9 13:01:52 2010 -0500

    Make using Jifty::Test::WWW::Declare warnings free
    
    The warnings pragma doesn't cross package boundaries, and Exporter was
    still throwing a redefined warning for get().  Sub::Exporter squashes
    this warning, so use that instead.  It adds a little more complexity to
    our already multi-headed import method, but not much.  Despite the added
    dep in Makefile.PL, Sub::Exporter should already exist thanks to
    pre-existing deps.
    
    We may just want to remove the declarative mech test framework entirely
    since it's not really used for Jifty, but it's possible some apps use
    it.

diff --git a/Makefile.PL b/Makefile.PL
index 5a8bbad..07e73b8 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -134,6 +134,7 @@ feature 'Development of a jifty application' =>
     recommends('Test::MockObject' => '1.07'),
     recommends('Module::Refresh' => '0.09'),
     recommends('Test::WWW::Declare' => '0.01'),
+    recommends('Sub::Exporter'); # This is already required by SQL::ReservedWords (and also by Moose if that's around), but make it explicit
     recommends('Test::Email' => 0),
     recommends('Email::Abstract' => 0),
     ;
diff --git a/lib/Jifty/Test/WWW/Declare.pm b/lib/Jifty/Test/WWW/Declare.pm
index fd32d2e..96cf758 100644
--- a/lib/Jifty/Test/WWW/Declare.pm
+++ b/lib/Jifty/Test/WWW/Declare.pm
@@ -3,9 +3,17 @@ package Jifty::Test::WWW::Declare;
 use strict;
 use warnings;
 use base qw(Exporter);
+
+# Sub::Exporter doesn't warn about redefining functions, which we do in the
+# import routine below
+use Sub::Exporter -setup => {
+    -as => 'export_subs',
+    exports => ['get'],
+};
+
 BEGIN { require Jifty::Test; require Test::WWW::Declare }
 
-our @EXPORT = qw($server $URL get);
+our @EXPORT = qw($server $URL);
 
 our $server;
 our $URL;
@@ -20,12 +28,15 @@ sub import
     # export the DSL-ey functions
     Test::WWW::Declare->export_to_level(2);
 
-    # export $server, $URL, and whatever else J:T:W:D adds
-    # note that this must come AFTER T:W:D->export because we override some
-    # of its functions
-    no warnings 'redefine';
+    # Note that these next exports must come AFTER T:W:D->export because we
+    # override parts of it
+
+    # Exporter: $server and $URL
     __PACKAGE__->export_to_level(1);
 
+    # Sub::Exporter: get()
+    __PACKAGE__->export_subs({ into_level => 1 }, 'get');
+
     # create a server (which will be automatically exported)
     $server = Jifty::Test->make_server;
     $URL = $server->started_ok;

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list