From: Dan Dascalescu Date: Thu, 7 Jan 2010 22:23:22 +0000 (+0000) Subject: Moved 'Extending RenderView' at the end of the Controllers section, and let 'Action... X-Git-Tag: v5.8005~66 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=e2728084ad684d622fbc47f14097b28cff1f2021 Moved 'Extending RenderView' at the end of the Controllers section, and let 'Action Types' be at the start --- diff --git a/lib/Catalyst/Manual/Cookbook.pod b/lib/Catalyst/Manual/Cookbook.pod index b6496ad..8b450c5 100644 --- a/lib/Catalyst/Manual/Cookbook.pod +++ b/lib/Catalyst/Manual/Cookbook.pod @@ -1084,36 +1084,6 @@ set the appropriate content type and disposition. Controllers are the main point of communication between the web server and your application. Here we explore some aspects of how they work. -=head2 Extending RenderView (formerly DefaultEnd) - -The recommended approach for an C action is to use -L (taking the place of -L), which does what you usually need. -However there are times when you need to add a bit to it, but don't want -to write your own C action. - -You can extend it like this: - -To add something to an C action that is called before rendering -(this is likely to be what you want), simply place it in the C -method: - - sub end : ActionClass('RenderView') { - my ( $self, $c ) = @_; - # do stuff here; the RenderView action is called afterwards - } - -To add things to an C action that are called I rendering, -you can set it up like this: - - sub render : ActionClass('RenderView') { } - - sub end : Private { - my ( $self, $c ) = @_; - $c->forward('render'); - # do stuff here - } - =head2 Action Types =head3 Introduction @@ -1510,6 +1480,38 @@ information on passing arguments via C.) use base qw/Catalyst::Controller/; sub key1 : Chained('/') + +=head2 Extending RenderView (formerly DefaultEnd) + +The recommended approach for an C action is to use +L (taking the place of +L), which does what you usually need. +However there are times when you need to add a bit to it, but don't want +to write your own C action. + +You can extend it like this: + +To add something to an C action that is called before rendering +(this is likely to be what you want), simply place it in the C +method: + + sub end : ActionClass('RenderView') { + my ( $self, $c ) = @_; + # do stuff here; the RenderView action is called afterwards + } + +To add things to an C action that are called I rendering, +you can set it up like this: + + sub render : ActionClass('RenderView') { } + + sub end : Private { + my ( $self, $c ) = @_; + $c->forward('render'); + # do stuff here + } + + =head1 Deployment