[Catalyst-commits] r9907 - in Catalyst-Runtime/5.80/trunk: . lib t/aggregate t/lib/TestApp/Controller

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Tue Apr 28 08:53:13 GMT 2009


Author: t0m
Date: 2009-04-28 09:53:13 +0100 (Tue, 28 Apr 2009)
New Revision: 9907

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/Makefile.PL
   Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
   Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t
   Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm
Log:
Bump MX::MA again, couple of little tidyups

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2009-04-28 01:50:00 UTC (rev 9906)
+++ Catalyst-Runtime/5.80/trunk/Changes	2009-04-28 08:53:13 UTC (rev 9907)
@@ -8,11 +8,11 @@
           AGGREGATE_TESTS environment variable is set and a recent
           Test::Aggregate is available. (rafl)
         - POD formatting fix for Catalyst::Test (Dan Dascalescu)
-        - Bump to MooseX::MethodAttributes 0.08, to gain the 
+        - Bump to MooseX::MethodAttributes 0.09, to gain the 
           get_nearest_methods_with_attributes method allowing methods without
-          attributes in a subclass to override those with attributes in a superclass.
-          This fixes CatalystX::CRUD's method of overriding/disabling functionality
-          base controllers (t0m).
+          attributes in a subclass to override those with attributes in a 
+          superclass. This fixes CatalystX::CRUD's method of overriding /
+          disabling functionality from base controllers (t0m).
 
 5.80002 2009-04-22 01:28:36
         - Fix CATALYST_DEBUG and MYAPP_DEBUG environment variables

Modified: Catalyst-Runtime/5.80/trunk/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.80/trunk/Makefile.PL	2009-04-28 01:50:00 UTC (rev 9906)
+++ Catalyst-Runtime/5.80/trunk/Makefile.PL	2009-04-28 08:53:13 UTC (rev 9907)
@@ -9,7 +9,7 @@
 requires 'Scope::Upper' => '0.06';
 requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00801';
 requires 'Moose' => '0.73';
-requires 'MooseX::MethodAttributes::Inheritable' => '0.08';
+requires 'MooseX::MethodAttributes::Inheritable' => '0.09';
 requires 'Carp';
 requires 'Class::C3::Adopt::NEXT' => '0.07';
 requires 'Class::MOP' => '0.79';

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-04-28 01:50:00 UTC (rev 9906)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm	2009-04-28 08:53:13 UTC (rev 9907)
@@ -3,6 +3,7 @@
 use Moose;
 extends 'Catalyst::Component';
 use Moose::Util qw/find_meta/;
+use Moose::Util::MetaRole ();
 use bytes;
 use Scope::Upper ();
 use Catalyst::Exception;
@@ -2166,8 +2167,9 @@
 =cut
 
 sub _controller_init_base_classes {
-    my ($class, $component) = @_;
+    my ($app_class, $component) = @_;
     foreach my $class ( reverse @{ mro::get_linear_isa($component) } ) {
+        next unless $class =~ /^$app_class/;
         Moose->init_meta( for_class => $class )
             unless find_meta($class);
     }

Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t	2009-04-28 01:50:00 UTC (rev 9906)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t	2009-04-28 08:53:13 UTC (rev 9907)
@@ -4,23 +4,33 @@
 use FindBin;
 use lib "$FindBin::Bin/../lib";
 
-use Test::More tests => 7;
+use Test::More tests => 12;
 use Catalyst::Test 'TestApp';
 
 {
     my $response = request('http://localhost/moose/get_attribute');
     ok($response->is_success);
     is($response->content, '42', 'attribute default values get set correctly');
-    is($response->header('X-Catalyst-Test-Before'), 'before called', 'before works as expected');
 }
 
 {
-    TODO: {
-        local $TODO = 'Wrapping methods in a subclass, when the subclass contains no other methods with attributes is broken';
-        my $response = request('http://localhost/moose/methodmodifiers/get_attribute');       
-        ok($response->is_success);
-        is($response->content, '42', 'parent controller method called');
-        is($response->header('X-Catalyst-Test-Before'), 'before called', 'before works as expected');
-        is($response->header('X-Catalyst-Test-After'), 'after called', 'after works as expected');
-    }
+    my $response = request('http://localhost/moose/methodmodifiers/get_attribute');       
+    ok($response->is_success);
+    is($response->content, '42', 'parent controller method called');
+    is($response->header('X-Catalyst-Test-After'), 'after called', 'after works as expected');
 }
+
+{
+    my $response = request('http://localhost/moose/with_local_modifier');
+    ok($response->is_success);
+    is($response->content, '42', 'attribute default values get set correctly');
+    is($response->header('X-Catalyst-Test-Before'), 'before called', 'before works as expected');
+}
+{
+    my $response = request('http://localhost/moose/methodmodifiers/with_local_modifier');
+    ok($response->is_success);
+    is($response->content, '42', 'attribute default values get set correctly');
+    is($response->header('X-Catalyst-Test-After'), 'after called', 'after works as expected');
+    is($response->header('X-Catalyst-Test-Before'), 'before called', 'before works as expected');
+}
+

Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm	2009-04-28 01:50:00 UTC (rev 9906)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm	2009-04-28 08:53:13 UTC (rev 9907)
@@ -20,8 +20,13 @@
     $c->response->body($self->attribute);
 }
 
-before get_attribute => sub {
+sub with_local_modifier : Local {
     my ($self, $c) = @_;
+    $c->forward('get_attribute');
+}
+
+before with_local_modifier => sub {
+    my ($self, $c) = @_;
     $c->response->header( 'X-Catalyst-Test-Before' => 'before called' );
 };
 




More information about the Catalyst-commits mailing list