[0.011] ...
- - Fixed broken isa RenderView test case
+ - fixed broken isa RenderView test case
+ - parameterized roles now available in general
[0.010] Sun Sep 13 15:52:01 CEST 2009
- Fix Compat with MooseX::Method::Signatures >=0.22 ( KENTNL )
requires 'Moose', '0.89';
requires 'MooseX::AttributeHelpers', '0.21';
requires 'MooseX::Declare', '0.30';
-requires 'MooseX::MethodAttributes', '0.15';
+requires 'MooseX::MethodAttributes', '0.16';
+requires 'MooseX::Parameterized', '0.13';
requires 'MooseX::Types', '0.20';
requires 'MooseX::Method::Signatures', '0.26';
requires 'FindBin';
around bar_action (Object $ctx) { ... }
}
+ controller_role MyApp::Web::ControllerRole::WithParam (Str :$msg!) {
+
+ final action message under base {
+ $ctx->stash(message => $msg);
+ }
+ }
+
=head1 DESCRIPTION
This handler provides the C<controller_role> keyword. It is an extension of the
L<CatalystX::Declare::Keyword::Action>, which also documents the effects of
method modifiers on actions.
+=head2 Parameters
+
+You can use a parameter signature containing named parameters for a role. To
+apply the controller role in the L</SYNOPSIS>, you'd use code like this:
+
+ controller MyApp::Web::Controller::Hello {
+ with 'MyApp::Web::ControllerRole::WithParam' => { msg => 'Hello!' };
+
+ action base under '/' as '';
+ }
+
=head1 SUPERCLASSES
=over
use Test::More;
use Catalyst::Test 'TestApp';
-TODO: {
- local $TODO = 'MooseX::MethodAttributes needs to allow this';
- is get('/param/greet'), 'foo:foo', 'parameterized role was consumed correctly';
-}
+is get('/param/greet'), 'foo:foo', 'parameterized role was consumed correctly';
done_testing;
use CatalystX::Declare;
-controller TestApp::Controller::Parameterized is mutable {
+controller TestApp::Controller::Parameterized {
with 'TestApp::ControllerRole::Parameterized' => { message => 'foo' };
action base under '/' as 'param';
method get_message { $message }
final action greet under base {
- no warnings 'uninitialized'; # remove if TODO is fixed
$ctx->response->body( join ':', $self->get_message, $message );
}
}