X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FCatalystAndMoose.pod;h=3d0b957276627ae9521640220fcd9db55b39c185;hb=689db79636a1e294951d01bbcf930162c4aed544;hp=e2a0cfd1a647910d90a3142af4486e69d9284ff0;hpb=bbddff000787154dd9130f45634da8ef06529d86;p=catagits%2FCatalyst-Manual.git diff --git a/lib/Catalyst/Manual/CatalystAndMoose.pod b/lib/Catalyst/Manual/CatalystAndMoose.pod index e2a0cfd..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,39 +122,39 @@ 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 AUTHORS Catalyst Contributors, see Catalyst.pm