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

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Fri Jan 2 19:31:37 GMT 2009


Author: t0m
Date: 2009-01-02 19:31:37 +0000 (Fri, 02 Jan 2009)
New Revision: 8991

Removed:
   Catalyst-Runtime/5.80/trunk/t/lib/TestAppPluginWithNewMethod.pm
Modified:
   Catalyst-Runtime/5.80/trunk/Makefile.PL
   Catalyst-Runtime/5.80/trunk/TODO
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
   Catalyst-Runtime/5.80/trunk/t/plugin_new_method_backcompat.t
Log:
plugin new method test as-per various other plugins tests - shows issue with Hooks::EndOfScope, so switch to Scope::Upper on msts suggestion

Modified: Catalyst-Runtime/5.80/trunk/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.80/trunk/Makefile.PL	2009-01-02 12:45:25 UTC (rev 8990)
+++ Catalyst-Runtime/5.80/trunk/Makefile.PL	2009-01-02 19:31:37 UTC (rev 8991)
@@ -6,7 +6,7 @@
 all_from 'lib/Catalyst/Runtime.pm';
 
 requires 'namespace::clean';
-requires 'B::Hooks::EndOfScope';
+requires 'Scope::Upper';
 requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00700';
 requires 'Moose' => '0.64';
 requires 'Carp';

Modified: Catalyst-Runtime/5.80/trunk/TODO
===================================================================
--- Catalyst-Runtime/5.80/trunk/TODO	2009-01-02 12:45:25 UTC (rev 8990)
+++ Catalyst-Runtime/5.80/trunk/TODO	2009-01-02 19:31:37 UTC (rev 8991)
@@ -18,10 +18,13 @@
   - Run another round of repository smokes against latest 5.80 trunk, manually
     go through all the things which are broken (t0m).
     
-     - Catalyst::Plugin::Authorization::ACL
-     - Catalyst::Plugin::Server
-     - Catalyst::Plugin::HTML::Widget
-       - Should hopefully be fixed now..
+     - Catalyst-Plugin-Session-State-Cookie
+       Catalyst-Plugin-Session-Store-FastMmap
+       Catalyst-Plugin-Session-PerUser
+       Catalyst-Plugin-Session-Store-File
+       Catalyst-Authentication-Credential-HTTP
+       Catalyst-Plugin-SmartURI
+        - All fixed by Scope::Upper
      
      - Catalyst-Log-Log4perl Deep recursion on subroutine "MockApp::setup" 
        (rafl)
@@ -40,10 +43,6 @@
      still support that, but warn for/deprecate it so it can go for 5.9X...
      This obviously needs better tests :/
 
-  -  With 5.7 people did extends qw/Moose::Object Catalyst::Component/, now 
-     Catalyst::Component isa Moose::Object so now isa doesn't linearize 
-     anymore, test case..
-
 Cleanups:
     
   - Update Test suite to not assume MyApp ISA Controller
@@ -69,6 +68,10 @@
 
    - Fix the Roadmap to be less full of lies.
 
+   -  With 5.7 people did extends qw/Moose::Object Catalyst::Component/, now 
+      Catalyst::Component isa Moose::Object so now isa doesn't linearize 
+      anymore, docs of what doesn't work and why (rafl)
+
 Profiling:
 
   - vs 5.70 and optimisation as needed.

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-01-02 12:45:25 UTC (rev 8990)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-01-02 19:31:37 UTC (rev 8991)
@@ -8,7 +8,7 @@
 use Class::MOP::Object ();
 extends 'Catalyst::Component';
 use bytes;
-use B::Hooks::EndOfScope;
+use Scope::Upper ();
 use Catalyst::Exception;
 use Catalyst::Log;
 use Catalyst::Request;
@@ -1024,10 +1024,10 @@
     # Note however that we have to do the work on scope end, so that method
     # modifiers work correctly in MyApp (as you have to call setup _before_ 
     # applying modifiers).
-    on_scope_end {
+    Scope::Upper::reap(sub {
         my $meta = $class->Moose::Object::meta();
         $meta->make_immutable unless $meta->is_immutable;
-    };
+    }, 1);
 
     $class->setup_finished(1);
 }

Deleted: Catalyst-Runtime/5.80/trunk/t/lib/TestAppPluginWithNewMethod.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppPluginWithNewMethod.pm	2009-01-02 12:45:25 UTC (rev 8990)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestAppPluginWithNewMethod.pm	2009-01-02 19:31:37 UTC (rev 8991)
@@ -1,29 +0,0 @@
-{
-    package NewTestPlugin;
-    use strict;
-    use warnings;
-    sub new { 
-        my $class = shift;
-        return bless $_[0], $class; 
-    }
-}
-
-{
-    package TestAppPluginWithNewMethod;
-    use Test::Exception;
-    use Catalyst qw/+NewTestPlugin/;
-
-    sub foo : Local {
-        my ($self, $c) = @_;
-        $c->res->body('foo');
-    }
-
-    use Moose; # Just testing method modifiers still work.
-    __PACKAGE__->setup;
-    our $MODIFIER_FIRED = 0;
-
-    lives_ok {
-        before 'dispatch' => sub { $MODIFIER_FIRED = 1 }
-    } 'Can apply method modifier';
-    no Moose;
-}

Modified: Catalyst-Runtime/5.80/trunk/t/plugin_new_method_backcompat.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/plugin_new_method_backcompat.t	2009-01-02 12:45:25 UTC (rev 8990)
+++ Catalyst-Runtime/5.80/trunk/t/plugin_new_method_backcompat.t	2009-01-02 19:31:37 UTC (rev 8991)
@@ -8,10 +8,45 @@
 # that plugins don't get it wrong for us.
 
 # Also tests method modifiers and etc in MyApp.pm still work as expected.
+use Test::More tests => 3;
 
+{
+    package NewTestPlugin;
+    use strict;
+    use warnings;
+    sub new { 
+        my $class = shift;
+        return bless $_[0], $class; 
+    }
+}
+
+{   # This is all in the same file so that the setup method on the 
+    # application is called at runtime, rather than at compile time.
+    # This ensures that the end of scope hook has to happen at runtime
+    # correctly, otherwise the test will fail (ergo the switch from
+    # B::Hooks::EndOfScope to Sub::Uplevel)
+    package TestAppPluginWithNewMethod;
+    use Test::Exception;
+    use Catalyst qw/+NewTestPlugin/;
+
+    sub foo : Local {
+        my ($self, $c) = @_;
+        $c->res->body('foo');
+    }
+
+    use Moose; # Just testing method modifiers still work.
+    __PACKAGE__->setup;
+    our $MODIFIER_FIRED = 0;
+
+    lives_ok {
+        before 'dispatch' => sub { $MODIFIER_FIRED = 1 }
+    } 'Can apply method modifier';
+    no Moose;
+}
+
 use FindBin;
-use lib "$FindBin::Bin/lib";use Test::More tests => 3;
+use lib "$FindBin::Bin/lib";
 
-use Catalyst::Test qw/TestAppPluginWithNewMethod/; # 1 test for adding a modifer not throwing.
+use Catalyst::Test qw/TestAppPluginWithNewMethod/;
 ok request('/foo')->is_success; 
 is $TestAppPluginWithNewMethod::MODIFIER_FIRED, 1, 'Before modifier was fired correctly.';




More information about the Catalyst-commits mailing list