X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FCatalystAndMoose.pod;h=3d0b957276627ae9521640220fcd9db55b39c185;hb=4307eb1cd503012fb2ff86ecd1d0da6b7f5b3d25;hp=adcfaf3a68bd400a296b4bd412745a2e2553c15b;hpb=e91e320be26db95fc1bfdee31436cdbc09899cf7;p=catagits%2FCatalyst-Manual.git diff --git a/lib/Catalyst/Manual/CatalystAndMoose.pod b/lib/Catalyst/Manual/CatalystAndMoose.pod index adcfaf3..3d0b957 100644 --- a/lib/Catalyst/Manual/CatalystAndMoose.pod +++ b/lib/Catalyst/Manual/CatalystAndMoose.pod @@ -4,13 +4,13 @@ Catalyst::Manual::CatalystAndMoose - How Catalyst 5.8+ and Moose relate =head1 DESCRIPTION -Since version 5.8 the core of Catalyst is based on L. Although +Since version 5.8, the core of Catalyst is based on L. Although the developers went through great lengths to allow for a seamless transition, there are still a few things to keep in mind when trying to exploit the power of L in your Catalyst application. This document provides you with a short overview of common caveats and -best practices to use L-based classes within Catalyst. +best practices for using L-based classes within Catalyst. =head1 THE CONTEXT CLASS @@ -122,44 +122,47 @@ 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' }; - + 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'); - }; - + 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 { my ($self, $c) = @_; ... } + + package MyApp::Controller::Foo; + use Moose; + use namespace::autoclean; + BEGIN { extends 'Catalyst::Controller' }; + + with 'MyApp::ControllerRole'; - package MyApp::Controller::Foo; - use Moose; - use namespace::autoclean; - BEGIN { extends 'Catalyst::Controller' }; - - with 'MyApp::ControllerRole'; - -=head1 AUTHOR +=head1 AUTHORS -The Catalyst Core Team - see http://catalyst.perl.org/ +Catalyst Contributors, see Catalyst.pm =head1 COPYRIGHT -This program is free software. You can redistribute it and/or modify it -under the same terms as Perl itself. +This library is free software. You can redistribute it and/or modify it under +the same terms as Perl itself. + +=cut +