X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FCatalystAndMoose.pod;h=7355ef3869fd366acb746c96110e44c470756a0f;hp=6f6f9b4eab426066ed55ef22eaa6bf2285044b2b;hb=HEAD;hpb=46a5f2f5cf41f746d2a20ce0b64b6112f5283ac3 diff --git a/lib/Catalyst/Manual/CatalystAndMoose.pod b/lib/Catalyst/Manual/CatalystAndMoose.pod index 6f6f9b4..7355ef3 100644 --- a/lib/Catalyst/Manual/CatalystAndMoose.pod +++ b/lib/Catalyst/Manual/CatalystAndMoose.pod @@ -38,13 +38,13 @@ A Moose-ified version of the context class should look like this: $c->log->info( 'done!' ); } -You should also be aware that roles in C<< $c-Esetup >> are applied +You should also be aware that roles in C<< $c->setup >> are applied after the last plugin with all the benefits of using a single L statement in an ordinary L class. Your class is automatically made immutable at the end of the current file. -CAVEAT: Using roles in C<< $c-Esetup >> was implemented in Catalyst +CAVEAT: Using roles in C<< $c->setup >> was implemented in Catalyst version 5.80004. In prior versions you might get away with after 'setup_plugins' => sub{ with( @@ -58,14 +58,14 @@ version 5.80004. In prior versions you might get away with but this is discouraged and you should upgrade to 5.80004 anyway, because it fixes a few important regressions against 5.71 -CAVEAT: Using roles in C<< $c-Esetup >> will not currently allow +CAVEAT: Using roles in C<< $c->setup >> will not currently allow you to pass parameters to roles, or perform conflict resolution. Conflict detection still works as expected. =head2 ACCESSORS -Most of the request-specific attributes like C<$c-Estash>, -C<$c-Erequest> and C<$c-Eresponse> have been converted to +Most of the request-specific attributes like C<< $c->stash >>, +C<< $c->request >> and C<< $c->response >> have been converted to L attributes but without type constraints, attribute helpers or builder methods. This ensures that Catalyst 5.8 is fully backwards compatible to applications using the published API of Catalyst 5.7 but @@ -73,7 +73,7 @@ slightly limits the gains that could be had by wielding the full power of L attributes. Most of the accessors to information gathered during compile time (such -as configuration) are managed by C, which is a +as configuration) are managed by L, which is a L-aware version of L but not compatible with L. @@ -115,32 +115,32 @@ the actions themselves are declared: use namespace::autoclean; BEGIN { extends 'Catalyst::Controller'; } - + =head2 Controller Roles It is possible to use roles to apply method modifiers on controller actions from 5.80003 onwards, or use modifiers in your controller classes themselves. For example - package MyApp::Controller::Foo; - use Moose; - use namespace::autoclean; - BEGIN { extends 'Catalyst::Controller' }; - - sub foo : Local { - my ($self, $c) = @_; - $c->res->body('Hello '); - } - after foo => sub { - my ($self, $c) = @_; - $c->res->body($c->res->body . 'World'); - }; - + package MyApp::Controller::Foo; + use Moose; + use namespace::autoclean; + BEGIN { extends 'Catalyst::Controller' }; + + sub foo : Local { + my ($self, $c) = @_; + $c->res->body('Hello '); + } + after foo => sub { + my ($self, $c) = @_; + $c->res->body($c->res->body . 'World'); + }; + It is possible to have action methods with attributes inside Moose roles, using -the trait introduced in L version 0.12, example: +L, example: package MyApp::ControllerRole; - use Moose::Role -traits => 'MethodAttributes'; + use MooseX::MethodAttributes::Role; use namespace::autoclean; sub foo : Local { @@ -148,13 +148,13 @@ the trait introduced in L version 0.12, example: ... } - package MyApp::Controller::Foo; - use Moose; - use namespace::autoclean; - BEGIN { extends 'Catalyst::Controller' }; + package MyApp::Controller::Foo; + use Moose; + use namespace::autoclean; + BEGIN { extends 'Catalyst::Controller' }; + + with 'MyApp::ControllerRole'; - with 'MyApp::ControllerRole'; - =head1 AUTHORS Catalyst Contributors, see Catalyst.pm