[Catalyst-commits] r9856 - in Catalyst-Runtime/5.80/trunk: .
lib/Catalyst t/aggregate t/lib/TestApp/Controller
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sun Apr 26 11:11:39 GMT 2009
Author: t0m
Date: 2009-04-26 12:11:35 +0100 (Sun, 26 Apr 2009)
New Revision: 9856
Modified:
Catalyst-Runtime/5.80/trunk/Changes
Catalyst-Runtime/5.80/trunk/Makefile.PL
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.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:
Somewhat, but not much more sane. There are still bugs here, but this _should_ fix karpet's issue
Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes 2009-04-26 04:10:53 UTC (rev 9855)
+++ Catalyst-Runtime/5.80/trunk/Changes 2009-04-26 11:11:35 UTC (rev 9856)
@@ -8,6 +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
+ 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).
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-26 04:10:53 UTC (rev 9855)
+++ Catalyst-Runtime/5.80/trunk/Makefile.PL 2009-04-26 11:11:35 UTC (rev 9856)
@@ -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.06';
+requires 'MooseX::MethodAttributes::Inheritable' => '0.08';
requires 'Carp';
requires 'Class::C3::Adopt::NEXT' => '0.07';
requires 'Class::MOP' => '0.79';
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2009-04-26 04:10:53 UTC (rev 9855)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2009-04-26 11:11:35 UTC (rev 9856)
@@ -7,6 +7,7 @@
BEGIN { extends qw/Catalyst::Component MooseX::MethodAttributes::Inheritable/; }
+use MooseX::MethodAttributes;
use Catalyst::Exception;
use Catalyst::Utils;
@@ -179,8 +180,8 @@
my $meta = find_meta($self);
confess("Metaclass for " . ref($meta) ." for " . $meta->name
. " cannot support register_actions.")
- unless $meta->can('get_all_methods_with_attributes');
- my @methods = $meta->get_all_methods_with_attributes;
+ unless $meta->can('get_nearest_methods_with_attributes');
+ my @methods = $meta->get_nearest_methods_with_attributes;
return @methods;
}
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-26 04:10:53 UTC (rev 9855)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_moose.t 2009-04-26 11:11:35 UTC (rev 9856)
@@ -4,21 +4,23 @@
use FindBin;
use lib "$FindBin::Bin/../lib";
-use Test::More tests => 5;
+use Test::More tests => 7;
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');
}
{
- my $response = request('http://localhost/moose/methodmodifiers/get_attribute');
- ok($response->is_success);
- is($response->content, '42', 'parent controller method called');
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');
}
}
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-26 04:10:53 UTC (rev 9855)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Moose.pm 2009-04-26 11:11:35 UTC (rev 9856)
@@ -5,6 +5,10 @@
use namespace::clean -except => 'meta';
BEGIN { extends qw/Catalyst::Controller/; }
+use MooseX::MethodAttributes; # FIXME - You need to say this if you have
+ # modifiers so that you get the correct
+ # method metaclass, why does the modifier
+ # on MODIFY_CODE_ATTRIBUTES not work.
has attribute => (
is => 'ro',
@@ -16,4 +20,9 @@
$c->response->body($self->attribute);
}
+before get_attribute => sub {
+ my ($self, $c) = @_;
+ $c->response->header( 'X-Catalyst-Test-Before' => 'before called' );
+};
+
1;
More information about the Catalyst-commits
mailing list