doc updates, esp. DefaultEnd related
Jesse Sheidlower [Tue, 27 Jun 2006 03:21:38 +0000 (03:21 +0000)]
lib/Catalyst/Manual/Actions.pod
lib/Catalyst/Manual/Cookbook.pod
lib/Catalyst/Manual/Intro.pod
lib/Catalyst/Manual/Plugins.pod

index 838878f..8794f90 100644 (file)
@@ -4,33 +4,34 @@ Catalyst::Manual::Actions - Catalyst Reusable Actions
 
 =head1 DESCRIPTION
 
-This section of the manual describes the reusable action system in catalyst,
-how they work, descriptions of some existing ones, and how to write your own.
-Reusable actions are attributes on Catalyst methods that allow you to decorate
-your method with functions running before or after the method call.
-This can be used to implement commonly used action patterns, while still
-leaving you full freedom to customize them.
+This section of the manual describes the reusable action system in
+Catalyst, how they work, descriptions of some existing ones, and how to
+write your own.  Reusable actions are attributes on Catalyst methods
+that allow you to decorate your method with functions running before or
+after the method call.  This can be used to implement commonly used
+action patterns, while still leaving you full freedom to customize them.
 
 =head1 USING ACTIONS
 
-This is pretty simple. It works just like the normal dispatch attributes you
-are used to, like Local or Private:
+This is pretty simple. It works just like the normal dispatch attributes
+you are used to, like Local or Private:
 
   sub Hello :Local :ActionClass('SayBefore') { 
        $c->res->output( 'Hello '.$c->stash->{what} );
   }
 
-In this example, we expect the SayBefore action to magically populate stash with
-something relevant before Hello is run.  In the next section we'll show you
-how to implement it. If you want it in another namespace than Catalyst::Action
-you can prefix the action name with a '+', for instance '+Foo::SayBefore',
-or if you just want it under your application namespace instead, use MyAction,
-like MyAction('SayBefore').
+In this example, we expect the SayBefore action to magically populate
+stash with something relevant before C<Hello> is run.  In the next
+section we'll show you how to implement it. If you want it in another
+namespace than Catalyst::Action you can prefix the action name with a
+'+', for instance '+Foo::SayBefore', or if you just want it under your
+application namespace instead, use MyAction, like MyAction('SayBefore').
 
 =head1 WRITING YOUR OWN ACTIONS
 
-Implementing the action is self is almost as easy. Just use L<Catalyst::Action>
-as a base class and decorate the 'execute' call in the Action class:
+Implementing the action is self is almost as easy. Just use
+L<Catalyst::Action> as a base class and decorate the C<execute> call in
+the Action class:
 
   package Catalyst::Action::SayBefore;
 
@@ -45,8 +46,8 @@ as a base class and decorate the 'execute' call in the Action class:
 
   1;
 
-If you want to do something after the action, just put it after the execute 
-call. Pretty simple, huh?
+If you want to do something after the action, just put it after the
+C<execute> call. Pretty simple, huh?
 
 =head1 ACTIONS
 
@@ -56,4 +57,11 @@ This is meant to decorate end actions. It's similar in operation to
 L<Catalyst::Plugin::DefaultEnd>, but allows you to decide on an action
 level rather than on an application level where it should be run.
 
-=cut
+=head1 AUTHOR
+
+The Catalyst Core Team - see http://catalyst.perl.org/
+
+=head1 COPYRIGHT
+
+This program is free software. You can redistribute it and/or modify it
+under the same terms as Perl itself.
index c5aed3c..8cd1668 100644 (file)
@@ -30,7 +30,8 @@ condition in the C<end> action. For example:
 Then just add to your query string C<&dump_info=1> (or if there's no
 query string for the request, add C<?dump_info=1> to the end of the URL)
 to force debug output. This feature is included in
-L<Catlyst::Plugin::DefaultEnd>.
+L<Catalyst::Action::RenderView> (formerly
+L<Catalyst::Plugin::DefaultEnd>).
 
 
 =head2 Disable statistics
@@ -764,28 +765,35 @@ This will let all files within root/static be handled directly by Apache.  In
 a two-tiered setup, the frontend server should handle static files.
 The configuration to do this on the frontend will vary.
 
-=head2 Extending DefaultEnd
+=head2 Extending RenderView (formerly DefaultEnd)
 
-Most people use L<Catalyst::Plugin::DefaultEnd> as their
-end action; it 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<end> action.
+The recommended approach for an C<end> action is to use
+L<Catalyst::Action::RenderView> (taking the place of
+L<Catalyst::Plugin::DefaultEnd>), 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<end> action.
 
-Simply extend it like this:
+You can extend it like this:
 
-  use Catalyst qw/DefaultEnd/;
+To add something to an C<end> action that is called before rendering
+(this is likely to be what you want), simply place it in the C<end>
+method:
 
-  # (time passes)
-
-  sub end : Private {
+    sub end : ActionClass('RenderView') {
       my ( $self, $c ) = @_;
+      # do stuff here; the RenderView action is called afterwards
+    }
 
-      ... # code before view
+To add things to an C<end> action that are called I<after> rendering,
+you can set it up like this:
 
-      $c->NEXT::end( $c );
-  
-      ... # code after view
-  }
+    sub render : ActionClass('RenderView') { }
+
+    sub end : Private { 
+      my ( $self, $c ) = @_;
+      $c->forward('render');
+      # do stuff here
+    }
   
 =head2 Catalyst on shared hosting
 
index 44a80b4..6ba61e3 100644 (file)
@@ -831,7 +831,8 @@ C<$c-E<gt>forward(qw/MyApp::View::TT process/)>.
     }
 
 You normally render templates at the end of a request, so it's a perfect
-use for the global C<end> action.
+use for the global C<end> action. (In practice, however, you would use a
+default C<end> action as supplied by L<Catalyst::Action::DefaultEnd>.)
 
 Also, be sure to put the template under the directory specified in
 C<$c-E<gt>config-E<gt>{root}>, or you'll be forced to look at our
index b1569c0..4391cb8 100644 (file)
@@ -10,10 +10,11 @@ are not distributed with Catalyst but should be available from CPAN.
 They typically require additional modules from CPAN.
 
 This list may well be outdated by the time you read this and some
-plugins may be deprecated or now part of core L<Catalyst>. Be sure 
-to check the Catalyst::Plugin namespace for additional plugins and consult 
-the mailing list ( L<http://dev.catalyst.perl.org/wiki/Support> ) for advice 
-on the current status or preferred use of your chosen plugin/framework.
+plugins may be deprecated or now part of core L<Catalyst>. Be sure to
+check the Catalyst::Plugin namespace for additional plugins and consult
+the mailing list ( L<http://dev.catalyst.perl.org/wiki/Support> ) for
+advice on the current status or preferred use of your chosen
+plugin/framework.
 
 =head1 PLUGINS
 
@@ -23,8 +24,8 @@ Provides Account Auto-Discovery for Catalyst.
 
 =head2 L<Catalyst::Plugin::Acme::Scramble>
 
-Implements a potent meme about how easily we can read scrambled text if the
-first and last letters remain constant. Operates on text/plain and
+Implements a potent meme about how easily we can read scrambled text if
+the first and last letters remain constant. Operates on text/plain and
 text/html served by your Catalyst application.
 
 =head2 L<Catalyst::Plugin::Alarm>
@@ -75,6 +76,12 @@ Part of the Authentication Framework L<Catalyst::Plugin::Authentication>.
 
 Integrates L<Authen::TypeKey> with L<Catalyst::Plugin::Authentication>.
 
+=head2 L<Catalyst::Plugin::Authentication::OpenID>
+
+L<Catalyst::Plugin::Authentication::OpenID> is a plugin that implements 
+support for OpenID authentication. For more information on OpenID, take 
+a look at L<http://www.openid.net/>.
+
 =head2 L<Catalyst::Plugin::Authentication::Store>
 
 The core authentication store documentation.
@@ -120,9 +127,9 @@ for Catalyst based on L<Catalyst::Plugin::Authentication>.
 
 =head2 L<Catalyst::Plugin::Browser>
 
-Extends L<Catalyst::Request> by adding the capability of browser detection.
-It returns an instance of L<HTTP::BrowserDetect>, which lets you get information 
-from the client's user agent.
+Extends L<Catalyst::Request> by adding the capability of browser
+detection.  It returns an instance of L<HTTP::BrowserDetect>, which lets
+you get information from the client's user agent.
 
 =head2 Catalyst::Plugin::Cache::FastMmap, FileCache, BerkeleyDB, and Memcached
 
@@ -381,16 +388,17 @@ and primary keys.
 
 =head2 L<Catalyst::Model::CDBI::Plain>
 
-A neutral interface to the C<Class::DBI> module which does not attempt to
-automate table setup. It allows the user to manually set up C<Class::DBI>
-classes, either by doing so within the Catalyst model classes themselves,
-or by inheriting from existing C<Class::DBI> classes.
+A neutral interface to the C<Class::DBI> module which does not attempt
+to automate table setup. It allows the user to manually set up
+C<Class::DBI> classes, either by doing so within the Catalyst model
+classes themselves, or by inheriting from existing C<Class::DBI>
+classes.
 
 =head2 L<Catalyst::Model::DBIC::Schema>
 
 A L<DBIx::Class> model class that can use either an explicit
-L<DBIx::Class::Schema> or one automatically loaded from your database via
-L<DBIx::Class::Schema::Loader>.
+L<DBIx::Class::Schema> or one automatically loaded from your database
+via L<DBIx::Class::Schema::Loader>.
 
 =head2 L<Catalyst::Model::EVDB>
 
@@ -485,12 +493,6 @@ Replaced by L<Catalyst::Plugin::Authentication::Credential::HTTP>.
 
 Replaced by L<Catalyst::Plugin::Authentication::Store::LDAP>.
 
-=head2 L<Catalyst::Plugin::Authentication::OpenID>
-
-L<Catalyst::Plugin::Authentication::OpenID> is a plugin that implements 
-support for OpenID authentication. For more information on OpenID, take 
-a look at L<http://www.openid.net/>.
-
 =head2 L<Catalyst::Plugin::Authentication::Simple>
 
 Replaced by L<Catalyst::Plugin::Authentication>.
@@ -501,9 +503,13 @@ Replaced by L<Catalyst::Plugin::Authentication>.
 
 =head2 Catalyst::Plugin::Config::*
 
-The L<Catalyst::Plugin::Config::JSON> and L<Catalyst::Plugin::Config::YAML>
-modules have been replaced by their corresponding L<Catalyst::Plugin::ConfigLoader>
-modules.
+The L<Catalyst::Plugin::Config::JSON> and
+L<Catalyst::Plugin::Config::YAML> modules have been replaced by their
+corresponding L<Catalyst::Plugin::ConfigLoader> modules.
+
+=head2 L<Catalyst::Plugin::DefaultEnd>
+
+Replaced by L<Catalyst::Action::RenderView>
 
 =head2 L<Catalyst::Plugin::SanitizeUrl>