Moving Catalyst::Manual from Catalyst-Runtime to Catalyst-Manual dist
Jonathan Rockway [Fri, 20 Oct 2006 08:32:17 +0000 (08:32 +0000)]
lib/Catalyst/Manual/About.pod [new file with mode: 0644]
lib/Catalyst/Manual/Actions.pod [new file with mode: 0644]
lib/Catalyst/Manual/Cookbook.pod [new file with mode: 0644]
lib/Catalyst/Manual/DevelopmentProcess.pod [new file with mode: 0644]
lib/Catalyst/Manual/Installation.pod [new file with mode: 0644]
lib/Catalyst/Manual/Installation/CentOS4.pod [new file with mode: 0644]
lib/Catalyst/Manual/Internals.pod [new file with mode: 0644]
lib/Catalyst/Manual/Intro.pod [new file with mode: 0644]
lib/Catalyst/Manual/Plugins.pod [new file with mode: 0644]
lib/Catalyst/Manual/Tutorial/README [new file with mode: 0644]
lib/Catalyst/Manual/WritingPlugins.pod [new file with mode: 0644]

diff --git a/lib/Catalyst/Manual/About.pod b/lib/Catalyst/Manual/About.pod
new file mode 100644 (file)
index 0000000..4625eaf
--- /dev/null
@@ -0,0 +1,317 @@
+=head1 NAME
+
+Catalyst::Manual::About - The philosophy of Catalyst
+
+=head1 DESCRIPTION
+
+This document is a basic introduction to the I<why> of Catalyst. It does
+not teach you how to write Catalyst applications; for an introduction to
+that please see L<Catalyst::Manual::Intro>. Rather, it explains the
+basics of what Catalyst is typically used for, and why you might want
+to use Catalyst to build your applications.
+
+=head2 What is Catalyst? The short summary
+
+Catalyst is a web application framework. This means that you use it to
+help build applications that run on the web, or that run using protocols
+used for the web. Catalyst is designed to make it easy to manage the
+various tasks you need to do to run an application on the web, either by
+doing them itself, or by letting you "plug in" existing Perl modules
+that do what you need. There are a number of things you typically do
+with a web application. For example:
+
+=over 4
+
+=item * Interact with a web server
+
+If you're on the web, you're relying on a web server, a program that
+sends files over the web. There are a number of these, and your
+application has to do the right thing to make sure that your program
+works with the web server you're using. If you change your web server,
+you don't want to have to rewrite your entire application to work with
+the new one.
+
+=item * Do something based on a URI
+
+It's typical for web applications to use URIs as a main way for users to
+interact with the rest of the application; various elements of the URI
+will indicate what the application needs to do. Thus,
+C<http://www.mysite.com/add_record.cgi?name=John&title=President> will
+add a person named "John" whose title is "President" to your database,
+and C<http://www.mysite.com/catalog/display/23> will go to a "display"
+of item 23 in your catalog, and
+C<http://www.mysite.com/order_status/7582> will display the status of
+order 7582, and C<http://www.mysite.com/add_comment/?page=8> will
+display a form to add a comment to page 8. Your application needs to
+have a regular way of processing these URIs so it knows what to do
+when such a request comes in.
+
+=item * Interact with a data store
+
+You probably use a database to keep track of your information. Your
+application needs to interact with your database, so you can create,
+edit, and retrieve your data.
+
+=item * Handle forms
+
+When a user submits a form, you receive it, process it to make sure it's
+been filled in properly, and then do something based on the
+result--submit an order, update a record, send e-mail, or return to the
+form if there's an error.
+
+=item * Display results
+
+If you have an application running on the web, people need to see
+things. You usually want your application displayed on a web browser, in
+which case you will probably be using a template system to help generate
+HTML code. But you might need other kinds of display, such as PDF files,
+or other forms of output, such as RSS feeds or e-mail.
+
+=item * Manage users
+
+You might need the concept of a "user", someone who's allowed to use
+your system, and is allowed to do certain things only. Perhaps normal
+users can only view or modify their own information; administrative
+users can view or modify anything; normal users can only order items for
+their own account; normal users can view things but not modify them;
+order-processing users can send records to a different part of the
+system; and so forth. You need a way of ensuring that people are who
+they say they are, and that people only do the things they're allowed to
+do.
+
+=item * Develop the application itself
+
+When you're writing or modifying the application, you want to have
+access to detailed logs of what it is doing. You want to be able to
+write tests to ensure that it does what it's supposed to, and that new
+changes don't break the existing code.
+
+=back
+
+Catalyst makes it easy to do all of these tasks, and many more. It is
+extremely flexible in terms of what it allows you to do, and very fast.
+It has a very large number of "plugins" that interact with existing Perl
+modules so that you can easily use them from within your
+application. 
+
+=over 4
+
+=item * Interact with a web server? 
+
+Catalyst lets you use a number of different ones, and even comes with a
+built-in server for testing or local deployment.
+
+=item * Do something based on a URI? 
+
+Catalyst has extremely flexible systems for figuring out what to do
+based on a URI.
+
+=item * Interact with a data store?
+
+Catalyst has many plugins for different databases and database
+frameworks, and for other non-database storage systems.
+
+=item * Handle forms? 
+
+Catalyst has plugins available for several form creation and validation
+systems that make it easy for the programmer to manage.
+
+=item * Display results?
+
+Catalyst has plugins available for a number of template modules and
+other output packages.
+
+=item * Manage users? 
+
+Catalyst has plugins that handle sessions, authentication, and
+authorization, in any way you need.
+
+=item * Developing the application? 
+
+Catalyst has detailed logging built-in, which you can configure as
+necessary, and supports the easy creation of new tests--some of which
+are automatically created when you begin writing a new application.
+
+=back
+
+=head3 What B<isn't> Catalyst?
+
+Catalyst is not an out-of-the-box solution that allows you to set up a
+complete working e-commerce application in ten minutes. (There are,
+however, several systems built on top of Catalyst that can get you very
+close to a working app.)
+
+Catalyst is designed for flexibility and power; to an extent, this comes
+at the expense of simplicity. Programmers have many options for almost
+everything they need to do, which means that any given need can be done
+in many ways, and finding the one that's right for you, and learning the
+right way to do it, can take time. TIMTOWDI works both ways.
+
+Catalyst is not designed for end users, but for working programmers.
+
+=head2 Web programming: The Olden Days
+
+Perl has long been favored for web applications. There are a wide
+variety of ways to use Perl on the web, and things have changed over
+time. It's possible to handle everything with very raw Perl code:
+
+    print "Content-type: text/html\n\n<center><h1>Hello
+    World!</h1></center>";
+
+for example, or
+
+    my @query_elements = split(/&/, $ENV{'QUERY_STRING'});
+    foreach my $element (@query_elements) {
+        my ($name, $value) = split(/=/, $element);
+        # do something with your parameters, or kill yourself
+        # in frustration for having to program like this
+    }
+
+Much better than this is to use Lincoln Stein's great L<CGI> module,
+which smoothly handles a wide variety of common tasks--parameter
+parsing, generating form elements from Perl data structures, printing
+http headers, escaping text, and very many more, all with your choice of
+functional or object-oriented style. While L<CGI> was revolutionary and
+is still widely used, it has various drawbacks that make it unsuitable
+for larger applications: it is slow; your code with it generally
+combines application logic and display code; and it makes it very
+difficult to handle larger applications with complicated control flow.
+
+A variety of frameworks followed, of which the most widely used is
+probably L<CGI::Application>, which encourages the development of
+modular code, with easy-to-understand control-flow handling, the use of
+plugins and templating systems, and the like. Other systems include
+L<AxKit>, which is designed for use with XML running under mod_perl;
+L<Maypole>--upon which Catalyst was originally based--designed for the
+easy development of powerful web databases; L<Jifty>, which does a great
+deal of automation in helping to set up web sites with many complex
+features; and Ruby on Rails (see L<http://www.rubyonrails.org>), written
+of course in Ruby and among the most popular web development systems. Is
+it not the purpose of this document to criticize or even briefly
+evaluate these other frameworks; they may be useful for you and if so we
+encourage you to give them a try.
+
+=head2 The MVC pattern
+
+MVC, or Model-View-Controller, is a model currently favored for web
+applications. This design pattern is originally from the Smalltalk
+programming language. The basic idea is that the three main areas of an
+application--handling application flow (Controller), processing
+information (Model), and outputting the results (View)--are kept
+separate, so that it is possible to change or replace any one without
+affecting the others, and so that if you're interested in one particular
+aspect, you know where to find it.
+
+Discussions of MVC often degenerate into nitpicky arguments about the
+history of the pattern, and exactly what "usually" or "should" go into
+the Controller or the Model. We have no interest in joining such a
+debate. In any case, Catalyst does not enforce any particular setup; you
+are free to put any sort of code in any part of your application, and
+this discussion, along with others elsewhere in the Catalyst
+documentation, are only suggestions based on what we think works
+well. In most Catalyst applications, each branch of MVC will be made of
+up of several Perl modules that can handle different needs in your
+application.
+
+The purpose of the B<Model> is to access and modify data. Typically the
+Model will interact with a relational database, but it's also common to
+use other data sources, such as the L<Xapian|Catalyst::Model::Xapian>
+search engine or an LDAP server.
+
+The purpose of the B<View> is to present data to the user. Typical Views
+use a templating module to generate HTML code, using L<Template
+Toolkit|Template>, L<Mason|HTML::Mason>, L<HTML::Template>, or the like,
+but it's also possible to generate PDF output, send e-mail, etc., from a
+View. In Catalyst applications the View is usually a small module, just
+gluing some other module into Catalyst; the display logic is written
+within the template itself.
+
+The Controller is Catalyst itself. When a request is made to Catalyst,
+it will be received by one of your Controller modules; this module
+will figure out what the user is trying to do, gather the necessary
+data from a Model, and send it to a View for display.
+
+=head3 A simple example
+
+The general idea is that you should be able to change things around
+without affecting the rest of your application. Let's look at a very
+simple example (keeping in mind that there are many ways of doing this,
+and what we're discussing is one possible way, not the only
+way). Suppose you have a record to display. It doesn't matter if it's a
+catalog entry, a library book, a music CD, a personnel record, or
+anything else, but let's pretend it's a catalog entry. A user is given a
+URL such as C<http://www.mysite.com/catalog/display/2782>. Now what?
+
+First, Catalyst figures out that you're using the "catalog" Controller
+(how Catalyst figures this out is entirely up to you; URL dispatching is
+I<extremely> flexible in Catalyst). Then Catalyst determines that you
+want to use a C<display> method in your "catalog" Controller. (There
+could be other C<display> methods in other Controllers, too.) Somewhere
+in this process, it's possible that you'll have authentication and
+authorization routines to make sure that the user is registered and is
+allowed to display a record. The Controller's C<display> method will
+then extract "2782" as the record you want to retrieve, and make a
+request to a Model for that record. The Controller will then look at
+what the Model returns: if there's no record, the Controller will ask
+the View to display an error message, otherwise it will hand the View
+the record and ask the View to display it. In either case, the View will
+then generate an HTML page, which Catalyst will send to the user's
+browser, using whatever web server you've configured.
+
+How does this help you?
+
+In many ways. Suppose you have a small catalog now, and you're using a
+lightweight database such as SQLite, or maybe just a text file. But
+eventually your site grows, and you need to upgrade to something more
+powerful--MySQL or Postgres, or even Oracle or DB2. If your Model is
+separate, you only have to change one thing, the Model; your Controller
+can expect that if it issues a query to the Model, it will get the right
+kind of result back.
+
+What about the View? The idea is that your template is concerned almost
+entirely with display, so that you can hand it off to a designer who
+doesn't have to worry about how to write code. If you get all the data
+in the Controller and then pass it to the View, the template isn't
+responsible for any kind of data processing. And if you want to change
+your output, it's simple: just write a new View. If your Controller is
+already getting the data you need, you can pass it in the same way, and
+whether you display the results to a web browser, generate a PDF, or
+e-mail the results back to the user, the Controller hardly changes at
+all--it's up to the View.
+
+And throughout the whole process, most of the tools you need are either
+part of Catalyst (the parameter-processing routines that extract "2782"
+from the URL, for example) or are easily plugged into it (the
+authentication routines, or the plugins for using Template Toolkit as
+your View).
+
+Now, Catalyst doesn't enforce very much at all. Template Toolkit is a
+very powerful templating system, and you can connect to a database,
+issue queries, and act on them from within a TT-based View, if you
+want. You can handle paging (i.e. retrieving only a portion of the total
+records possible) in your Controller or your Model. In the above
+example, your Controller looked at the query result, determining whether
+to ask the View for a no-result error message, or for a result display;
+but it's perfectly possible to hand your query result directly to the
+View, and let your template decide what to do. It's up to you; Catalyst
+doesn't enforce anything.
+
+In some cases there might be very good reasons to do things a certain
+way (issuing database queries from a template defeats the whole purpose
+of separation-of-concerns, and will drive your designer crazy), while in
+others it's just a matter of personal preference (perhaps your template,
+rather than your Controller, is the better place to decide what to
+display if you get an empty result). Catalyst just gives you the tools.
+
+=head1 AUTHOR
+
+Jesse Sheidlower, C<jester@panix.com>
+
+=head1 SEE ALSO
+
+L<Catalyst>, L<Catalyst::Manual::Intro>
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it
+under the same terms as Perl itself.
diff --git a/lib/Catalyst/Manual/Actions.pod b/lib/Catalyst/Manual/Actions.pod
new file mode 100644 (file)
index 0000000..6cd5949
--- /dev/null
@@ -0,0 +1,67 @@
+=head1 NAME
+
+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.
+
+=head1 USING ACTIONS
+
+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 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 itself 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;
+
+  use base 'Catalyst::Action';
+
+  sub execute {
+    my $self = shift;
+    my ( $controller, $c, $test ) = @_;
+    $c->stash->{what} = 'world';
+    $self->NEXT::execute( @_ );
+  };
+
+  1;
+
+If you want to do something after the action, just put it after the
+C<execute> call. Pretty simple, huh?
+
+=head1 ACTIONS
+
+=head2 Catalyst::Action::RenderView
+
+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.
+
+=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.
diff --git a/lib/Catalyst/Manual/Cookbook.pod b/lib/Catalyst/Manual/Cookbook.pod
new file mode 100644 (file)
index 0000000..35e008c
--- /dev/null
@@ -0,0 +1,2356 @@
+=head1 NAME
+
+Catalyst::Manual::Cookbook - Cooking with Catalyst
+
+=head1 DESCRIPTION
+
+Yummy code like your mum used to bake!
+
+=head1 RECIPES
+
+=head1 Basics
+
+These recipes cover some basic stuff that is worth knowing for catalyst developers.
+
+=head2 Delivering a Custom Error Page
+
+By default, Catalyst will display its own error page whenever it
+encounters an error in your application. When running under C<-Debug>
+mode, the error page is a useful screen including the error message and
+L<Data::Dump> output of the relevant parts of the C<$c> context object. 
+When not in C<-Debug>, users see a simple "Please come back later" screen.
+
+To use a custom error page, use a special C<end> method to short-circuit
+the error processing. The following is an example; you might want to
+adjust it further depending on the needs of your application (for
+example, any calls to C<fillform> will probably need to go into this
+C<end> method; see L<Catalyst::Plugin::FillInForm>).
+
+    sub end : Private {
+        my ( $self, $c ) = @_;
+
+        if ( scalar @{ $c->error } ) {
+            $c->stash->{errors}   = $c->error;
+            $c->stash->{template} = 'errors.tt';
+            $c->forward('MyApp::View::TT');
+            $c->error(0);
+        }
+
+        return 1 if $c->response->status =~ /^3\d\d$/;
+        return 1 if $c->response->body;
+
+        unless ( $c->response->content_type ) {
+            $c->response->content_type('text/html; charset=utf-8');
+        }
+
+        $c->forward('MyApp::View::TT');
+    }
+
+You can manually set errors in your code to trigger this page by calling
+
+    $c->error( 'You broke me!' );
+
+=head2 Disable statistics
+
+Just add this line to your application class if you don't want those nifty
+statistics in your debug messages.
+
+    sub Catalyst::Log::info { }
+
+=head2 Enable debug status in the environment
+
+Normally you enable the debugging info by adding the C<-Debug> flag to
+your C<use Catalyst> statement. However, you can also enable it using
+environment variable, so you can (for example) get debug info without
+modifying your application scripts. Just set C<CATALYST_DEBUG> or
+C<E<lt>MYAPPE<gt>_DEBUG> to a true value.
+
+=head2 Sessions
+
+When you have your users identified, you will want to somehow remember that
+fact, to save them from having to identify themselves for every single
+page. One way to do this is to send the username and password parameters in
+every single page, but that's ugly, and won't work for static pages. 
+
+Sessions are a method of saving data related to some transaction, and giving
+the whole collection a single ID. This ID is then given to the user to return
+to us on every page they visit while logged in. The usual way to do this is
+using a browser cookie.
+
+Catalyst uses two types of plugins to represent sessions:
+
+=head3 State
+
+A State module is used to keep track of the state of the session between the
+users browser, and your application.  
+
+A common example is the Cookie state module, which sends the browser a cookie
+containing the session ID. It will use default value for the cookie name and
+domain, so will "just work" when used. 
+
+=head3 Store
+
+A Store module is used to hold all the data relating to your session, for
+example the users ID, or the items for their shopping cart. You can store data
+in memory (FastMmap), in a file (File) or in a database (DBI).
+
+=head3 Authentication magic
+
+If you have included the session modules in your application, the
+Authentication modules will automagically use your session to save and
+retrieve the user data for you.
+
+=head3 Using a session
+
+Once the session modules are loaded, the session is available as C<<
+$c->session >>, and can be writen to and read from as a simple hash reference.
+
+=head3 EXAMPLE
+
+  use Catalyst qw/
+                 Session
+                 Session::Store::FastMmap
+                 Session::State::Cookie
+                 /;
+
+
+  ## Write data into the session
+
+  sub add_item : Local {
+     my ( $self, $c ) = @_;
+
+     my $item_id = $c->req->param("item");
+
+     push @{ $c->session->{items} }, $item_id;
+
+  }
+
+  ## A page later we retrieve the data from the session:
+
+  sub get_items : Local {
+     my ( $self, $c ) = @_;
+
+     $c->stash->{items_to_display} = $c->session->{items};
+
+  }
+
+
+=head3 More information
+
+L<http://search.cpan.org/dist/Catalyst-Plugin-Session>
+
+L<http://search.cpan.org/dist/Catalyst-Plugin-Session-State-Cookie>
+
+L<http://search.cpan.org/dist/Catalyst-Plugin-Session-State-URI>
+
+L<http://search.cpan.org/dist/Catalyst-Plugin-Session-Store-FastMmap>
+
+L<http://search.cpan.org/dist/Catalyst-Plugin-Session-Store-File>
+
+L<http://search.cpan.org/dist/Catalyst-Plugin-Session-Store-DBI>
+
+=head2 Configure your application
+
+You configure your application with the C<config> method in your
+application class. This can be hard-coded, or brought in from a
+separate configuration file.
+
+=head3 Using YAML
+
+YAML is a method for creating flexible and readable configuration
+files. It's a great way to keep your Catalyst application configuration
+in one easy-to-understand location.
+
+In your application class (e.g. C<lib/MyApp.pm>):
+
+  use YAML;
+  # application setup
+  __PACKAGE__->config( YAML::LoadFile(__PACKAGE__->config->{'home'} . '/myapp.yml') );
+  __PACKAGE__->setup;
+
+Now create C<myapp.yml> in your application home:
+
+  --- #YAML:1.0
+  # DO NOT USE TABS FOR INDENTATION OR label/value SEPARATION!!!
+  name:     MyApp
+
+  # session; perldoc Catalyst::Plugin::Session::FastMmap
+  session:
+    expires:        '3600'
+    rewrite:        '0'
+    storage:        '/tmp/myapp.session'
+
+  # emails; perldoc Catalyst::Plugin::Email
+  # this passes options as an array :(
+  email:
+    - SMTP
+    - localhost
+
+This is equivalent to:
+
+  # configure base package
+  __PACKAGE__->config( name => MyApp );
+  # configure authentication
+  __PACKAGE__->config->{authentication} = {
+    user_class => 'MyApp::Model::MyDB::Customer',
+    ...
+  };
+  # configure sessions
+  __PACKAGE__->config->{session} = {
+    expires => 3600,
+    ...
+  };
+  # configure email sending
+  __PACKAGE__->config->{email} = [qw/SMTP localhost/];
+
+See also L<YAML>.
+
+=head1 Skipping your VCS's directories
+
+Catalyst uses Module::Pluggable to load Models, Views and Controllers.
+Module::Pluggable will scan through all directories and load modules
+it finds.  Sometimes you might want to skip some of these directories,
+for example when your version control system makes a subdirectory with
+meta-information in every version-controlled directory.  While
+Catalyst skips subversion and CVS directories already, there are other
+source control systems.  Here is the configuration you need to add
+their directories to the list to skip.
+
+You can make catalyst skip these directories using the Catalyst config:
+
+  # Configure the application
+  __PACKAGE__->config(
+      name => 'MyApp',
+      setup_components => { except => qr/SCCS/ },
+  );
+
+See the Module::Pluggable manual page for more information on B<except>
+and other options.
+
+=head1 Users and Access Control
+
+Most multiuser, and some single user web applications require that
+users identify themselves, and the application is often required to
+define those roles.  The recipes below describe some ways of doing
+this.
+
+=head2 Authentication (logging in)
+
+This is extensively covered in other documentation; see in particular
+L<Catalyst::Plugin::Authentication> and the Authentication chapter
+of the Tutorial at L<Catalyst::Manual::Tutorial::Authorization>.
+
+=head2 Pass-through login (and other actions)
+
+An easy way of having assorted actions that occur during the processing
+of a request that are orthogonal to its actual purpose - logins, silent
+commands etc. Provide actions for these, but when they're required for
+something else fill e.g. a form variable __login and have a sub begin
+like so:
+
+    sub begin : Private {
+      my ($self, $c) = @_;
+      foreach my $action (qw/login docommand foo bar whatever/) {
+        if ($c->req->params->{"__${action}"}) {
+          $c->forward($action);
+        }
+      }
+    }
+
+
+=head2 Role-based Authorization
+
+For more advanced access control, you may want to consider using role-based
+authorization. This means you can assign different roles to each user, e.g.
+"user", "admin", etc.
+
+The C<login> and C<logout> methods and view template are exactly the same as
+in the previous example.
+
+The L<Catalyst::Plugin::Authorization::Roles> plugin is required when
+implementing roles:
+
+ use Catalyst qw/
+    Authentication
+    Authentication::Credential::Password
+    Authentication::Store::Htpasswd
+    Authorization::Roles
+  /;
+
+Roles are implemented automatically when using
+L<Catalyst::Authentication::Store::Htpasswd>:
+
+  # no additional role configuration required
+  __PACKAGE__->config->{authentication}{htpasswd} = "passwdfile";
+
+Or can be set up manually when using L<Catalyst::Authentication::Store::DBIC>:
+
+  # Authorization using a many-to-many role relationship
+  __PACKAGE__->config->{authorization}{dbic} = {
+    'role_class'           => 'My::Model::DBIC::Role',
+    'role_field'           => 'name',
+    'user_role_user_field' => 'user',
+
+    # DBIx::Class only (omit if using Class::DBI)
+    'role_rel'             => 'user_role',
+
+    # Class::DBI only, (omit if using DBIx::Class)
+    'user_role_class'      => 'My::Model::CDBI::UserRole'
+    'user_role_role_field' => 'role',
+  };
+
+To restrict access to any action, you can use the C<check_user_roles> method:
+
+  sub restricted : Local {
+     my ( $self, $c ) = @_;
+
+     $c->detach("unauthorized")
+       unless $c->check_user_roles( "admin" );
+
+     # do something restricted here
+  }
+
+You can also use the C<assert_user_roles> method. This just gives an error if
+the current user does not have one of the required roles:
+
+  sub also_restricted : Global {
+    my ( $self, $c ) = @_;
+    $c->assert_user_roles( qw/ user admin / );
+  }
+  
+=head2 Authentication/Authorization
+
+This is done in several steps:
+
+=over 4
+
+=item Verification
+
+Getting the user to identify themselves, by giving you some piece of
+information known only to you and the user. Then you can assume that the user
+is who they say they are. This is called B<credential verification>.
+
+=item Authorization
+
+Making sure the user only accesses functions you want them to access. This is
+done by checking the verified users data against your internal list of groups,
+or allowed persons for the current page.
+
+=back
+
+=head3 Modules
+
+The Catalyst Authentication system is made up of many interacting modules, to
+give you the most flexibility possible.
+
+=head4 Credential verifiers
+
+A Credential module tables the user input, and passes it to a Store, or some
+other system, for verification. Typically, a user object is created by either
+this module or the Store and made accessible by a C<< $c->user >> call.
+
+Examples:
+
+ Password - Simple username/password checking.
+ HTTPD    - Checks using basic HTTP auth.
+ TypeKey  - Check using the typekey system.
+
+=head3 Storage backends
+
+A Storage backend contains the actual data representing the users. It is
+queried by the credential verifiers. Updating the store is not done within
+this system, you will need to do it yourself.
+
+Examples:
+
+ DBIC     - Storage using a database.
+ Minimal  - Storage using a simple hash (for testing).
+
+=head3 User objects
+
+A User object is created by either the storage backend or the credential
+verifier, and filled with the retrieved user information.
+
+Examples:
+
+ Hash     - A simple hash of keys and values.
+
+=head3 ACL authorization
+
+ACL stands for Access Control List. The ACL plugin allows you to regulate
+access on a path by path basis, by listing which users, or roles, have access
+to which paths.
+
+=head3 Roles authorization
+
+Authorization by roles is for assigning users to groups, which can then be
+assigned to ACLs, or just checked when needed.
+
+=head3 Logging in
+
+When you have chosen your modules, all you need to do is call the C<<
+$c->login >> method. If called with no parameters, it will try to find
+suitable parameters, such as B<username> and B<password>, or you can pass it
+these values.
+
+=head3 Checking roles
+
+Role checking is done by using the C<< $c->check_user_roles >> method, this will
+check using the currently logged in user (via C<< $c->user >>). You pass it
+the name of a role to check, and it returns true if the user is a member.
+
+=head3 EXAMPLE
+
+ use Catalyst qw/Authentication
+                 Authentication::Credential::Password
+                 Authentication::Store::Htpasswd
+                 Authorization::Roles/;
+
+ __PACKAGE__->config->{authentication}{htpasswd} = "passwdfile";
+
+  sub login : Local {
+     my ($self, $c) = @_;
+
+     if (    my $user = $c->req->param("user")
+         and my $password = $c->req->param("password") )
+     {
+         if ( $c->login( $user, $password ) ) {
+              $c->res->body( "hello " . $c->user->name );
+         } else {
+            # login incorrect
+         }
+     }
+     else {
+         # invalid form input
+     }
+  }
+
+  sub restricted : Local {
+     my ( $self, $c ) = @_;
+
+     $c->detach("unauthorized")
+       unless $c->check_user_roles( "admin" );
+
+     # do something restricted here
+  }
+
+=head3 Using authentication in a testing environment
+
+Ideally, to write tests for authentication/authorization code one would first
+set up a test database with known data, then use
+L<Test::WWW::Mechanize::Catalyst> to simulate a user logging in. Unfortunately
+the former can be rather awkward, which is why it's a good thing that the
+authentication framework is so flexible.
+
+Instead of using a test database, one can simply change the authentication
+store to something a bit easier to deal with in a testing
+environment. Additionally, this has the advantage of not modifying one's
+database, which can be problematic if one forgets to use the testing instead of
+production database.
+
+e.g.,
+
+  use Catalyst::Plugin::Authentication::Store::Minimal::Backend;
+
+  # Sets up the user `test_user' with password `test_pass'
+  MyApp->default_auth_store(
+    Catalyst::Plugin::Authentication::Store::Minimal::Backend->new({
+      test_user => { password => 'test_pass' },
+    })
+  );
+
+Now, your test code can call C<$c->login('test_user', 'test_pass')> and
+successfully login, without messing with the database at all.
+
+=head3 More information
+
+L<http://search.cpan.org/perldoc?Catalyst::Plugin::Authentication> has a longer explanation.
+
+=head2 Authorization
+
+=head3 Introduction
+
+Authorization is the step that comes after authentication. Authentication
+establishes that the user agent is really representing the user we think it's
+representing, and then authorization determines what this user is allowed to
+do.
+
+=head3 Role Based Access Control
+
+Under role based access control each user is allowed to perform any number of
+roles. For example, at a zoo no one but specially trained personnel can enter
+the moose cage (Mynd you, møøse bites kan be pretty nasti!). For example: 
+
+    package Zoo::Controller::MooseCage;
+
+    sub feed_moose : Local {
+        my ( $self, $c ) = @_;
+
+        $c->model( "Moose" )->eat( $c->req->param("food") );
+    }
+
+With this action, anyone can just come into the moose cage and feed the moose,
+which is a very dangerous thing. We need to restrict this action, so that only
+a qualified moose feeder can perform that action.
+
+The Authorization::Roles plugin let's us perform role based access control
+checks. Let's load it:
+
+    use Catalyst qw/
+        Authentication # yadda yadda
+        Authorization::Roles
+    /;
+
+And now our action should look like this:
+
+    sub feed_moose : Local {
+        my ( $self, $c ) = @_;
+
+        if ( $c->check_roles( "moose_feeder" ) ) {
+            $c->model( "Moose" )->eat( $c->req->param("food") );
+        } else {
+            $c->stash->{error} = "unauthorized";
+        }
+    }
+
+This checks C<< $c->user >>, and only if the user has B<all> the roles in the
+list, a true value is returned.
+
+C<check_roles> has a sister method, C<assert_roles>, which throws an exception
+if any roles are missing.
+
+Some roles that might actually make sense in, say, a forum application:
+
+=over 4
+
+=item *
+
+administrator
+
+=item *
+
+moderator
+
+=back
+
+each with a distinct task (system administration versus content administration).
+
+=head3 Access Control Lists
+
+Checking for roles all the time can be tedious and error prone.
+
+The Authorization::ACL plugin let's us declare where we'd like checks to be
+done automatically for us.
+
+For example, we may want to completely block out anyone who isn't a
+C<moose_feeder> from the entire C<MooseCage> controller:
+
+    Zoo->deny_access_unless( "/moose_cage", [qw/moose_feeder/] );
+
+The role list behaves in the same way as C<check_roles>. However, the ACL
+plugin isn't limited to just interacting with the Roles plugin. We can use a
+code reference instead. For example, to allow either moose trainers or moose
+feeders into the moose cage, we can create a more complex check:
+
+    Zoo->deny_access_unless( "/moose_cage", sub {
+        my $c = shift;
+        $c->check_roles( "moose_trainer" ) || $c->check_roles( "moose_feeder" );
+    });
+
+The more specific a role, the earlier it will be checked. Let's say moose
+feeders are now restricted to only the C<feed_moose> action, while moose
+trainers get access everywhere:
+
+    Zoo->deny_access_unless( "/moose_cage", [qw/moose_trainer/] );
+    Zoo->allow_access_if( "/moose_cage/feed_moose", [qw/moose_feeder/]);
+
+When the C<feed_moose> action is accessed the second check will be made. If the
+user is a C<moose_feeder>, then access will be immediately granted. Otherwise,
+the next rule in line will be tested - the one checking for a C<moose_trainer>.
+If this rule is not satisfied, access will be immediately denied.
+
+Rules applied to the same path will be checked in the order they were added.
+
+Lastly, handling access denial events is done by creating an C<access_denied>
+private action:
+
+    sub access_denied : Private {
+        my ( $self, $c, $action ) = @_;
+
+        
+    }
+
+This action works much like auto, in that it is inherited across namespaces
+(not like object oriented code). This means that the C<access_denied> action
+which is B<nearest> to the action which was blocked will be triggered.
+
+If this action does not exist, an error will be thrown, which you can clean up
+in your C<end> private action instead.
+
+Also, it's important to note that if you restrict access to "/" then C<end>,
+C<default>, etc will also be restricted.
+
+   MyApp->acl_allow_root_internals;
+
+will create rules that permit access to C<end>, C<begin>, and C<auto> in the
+root of your app (but not in any other controller).
+
+=head1 Models
+
+Models are where application data belongs.  Catalyst is exteremely
+flexible with the kind of models that it can use.  The recipes here
+are just the start.
+
+=head2 Using existing DBIC (etc.) classes with Catalyst
+
+Many people have existing Model classes that they would like to use with
+Catalyst (or, conversely, they want to write Catalyst models that can be
+used outside of Catalyst, e.g.  in a cron job). It's trivial to write a
+simple component in Catalyst that slurps in an outside Model:
+
+    package MyApp::Model::DB;
+    use base qw/Catalyst::Model::DBIC::Schema/;
+    __PACKAGE__->config(
+        schema_class => 'Some::DBIC::Schema',
+        connect_info => ['dbi:SQLite:foo.db', '', '', {AutoCommit=>1}];
+    );
+    1;
+
+and that's it! Now C<Some::DBIC::Schema> is part of your
+Cat app as C<MyApp::Model::DB>.
+
+=head2 DBIx::Class as a Catalyst Model
+
+See L<Catalyst::Model::DBIC::Schema>.
+
+=head2 XMLRPC
+
+Unlike SOAP, XMLRPC is a very simple (and imo elegant) web-services
+protocol, exchanging small XML messages like these:
+
+Request:
+
+    POST /api HTTP/1.1
+    TE: deflate,gzip;q=0.3
+    Connection: TE, close
+    Accept: text/xml
+    Accept: multipart/*
+    Host: 127.0.0.1:3000
+    User-Agent: SOAP::Lite/Perl/0.60
+    Content-Length: 192
+    Content-Type: text/xml
+
+    <?xml version="1.0" encoding="UTF-8"?>
+    <methodCall>
+        <methodName>add</methodName>
+        <params>
+            <param><value><int>1</int></value></param>
+            <param><value><int>2</int></value></param>
+        </params>
+    </methodCall>
+
+Response:
+
+    Connection: close
+    Date: Tue, 20 Dec 2005 07:45:55 GMT
+    Content-Length: 133
+    Content-Type: text/xml
+    Status: 200
+    X-Catalyst: 5.70
+
+    <?xml version="1.0" encoding="us-ascii"?>
+    <methodResponse>
+        <params>
+            <param><value><int>3</int></value></param>
+        </params>
+    </methodResponse>
+
+Now follow these few steps to implement the application:
+
+1. Install Catalyst (5.61 or later), Catalyst::Plugin::XMLRPC (0.06 or
+later) and SOAP::Lite (for XMLRPCsh.pl).
+
+2. Create an application framework:
+
+    % catalyst.pl MyApp
+    ...
+    % cd MyApp
+
+3. Add the XMLRPC plugin to MyApp.pm
+
+    use Catalyst qw/-Debug Static::Simple XMLRPC/;
+
+4. Add an API controller
+
+    % ./script/myapp_create.pl controller API
+
+5. Add a XMLRPC redispatch method and an add method with Remote
+attribute to lib/MyApp/Controller/API.pm
+
+    sub default : Private {
+        my ( $self, $c ) = @_;
+        $c->xmlrpc;
+    }
+
+    sub add : Remote {
+        my ( $self, $c, $a, $b ) = @_;
+        return $a + $b;
+    }
+
+The default action is the entry point for each XMLRPC request. It will
+redispatch every request to methods with Remote attribute in the same
+class.
+
+The C<add> method is not a traditional action; it has no private or
+public path. Only the XMLRPC dispatcher knows it exists.
+
+6. That's it! You have built your first web service. Let's test it with
+XMLRPCsh.pl (part of SOAP::Lite):
+
+    % ./script/myapp_server.pl
+    ...
+    % XMLRPCsh.pl http://127.0.0.1:3000/api
+    Usage: method[(parameters)]
+    > add( 1, 2 )
+    --- XMLRPC RESULT ---
+    '3'
+
+=head3 Tip
+
+Your return data type is usually auto-detected, but you can easily
+enforce a specific one.
+
+    sub add : Remote {
+        my ( $self, $c, $a, $b ) = @_;
+        return RPC::XML::int->new( $a + $b );
+    }
+    
+
+
+=head1 Views
+
+Views pertain to the display of your application.  As with models,
+catalyst is uncommonly flexible.  The recipes below are just a start.
+
+=head2 Catalyst::View::TT
+
+One of the first things you probably want to do when starting a new
+Catalyst application is set up your View. Catalyst doesn't care how you
+display your data; you can choose to generate HTML, PDF files, or plain
+text if you wanted.
+
+Most Catalyst applications use a template system to generate their HTML,
+and though there are several template systems available, Template
+Toolkit is probably the most popular.
+
+Once again, the Catalyst developers have done all the hard work, and
+made things easy for the rest of us. Catalyst::View::TT provides the
+interface to Template Toolkit, and provides Helpers which let us set it
+up that much more easily.
+
+=head3 Creating your View
+
+Catalyst::View::TT provides two different helpers for us to use: TT and
+TTSite.
+
+=head4 TT
+
+Create a basic Template Toolkit View using the provided helper script:
+
+    script/myapp_create.pl view TT TT
+
+This will create lib/MyApp/View/MyView.pm, which is going to be pretty
+empty to start. However, it sets everything up that you need to get
+started. You can now define which template you want and forward to your
+view. For instance:
+
+    sub hello : Local {
+        my ( $self, $c ) = @_;
+
+        $c->stash->{template} = 'hello.tt';
+
+        $c->forward( $c->view('TT') );
+    }
+
+In practice you wouldn't do the forwarding manually, but would
+use L<Catalyst::Action::RenderView>.
+
+=head4 TTSite
+
+Although the TT helper does create a functional, working view, you may
+find yourself having to create the same template files and changing the
+same options every time you create a new application. The TTSite helper
+saves us even more time by creating the basic templates and setting some
+common options for us.
+
+Once again, you can use the helper script:
+
+    script/myapp_create.pl view TT TTSite
+
+This time, the helper sets several options for us in the generated View.
+
+    __PACKAGE__->config({
+        CATALYST_VAR => 'Catalyst',
+        INCLUDE_PATH => [
+            MyApp->path_to( 'root', 'src' ),
+            MyApp->path_to( 'root', 'lib' )
+        ],
+        PRE_PROCESS  => 'config/main',
+        WRAPPER      => 'site/wrapper',
+        ERROR        => 'error.tt2',
+        TIMER        => 0
+    });
+
+=over
+
+=item 
+
+INCLUDE_PATH defines the directories that Template Toolkit should search
+for the template files.
+
+=item
+
+PRE_PROCESS is used to process configuration options which are common to
+every template file.
+
+=item
+
+WRAPPER is a file which is processed with each template, usually used to
+easily provide a common header and footer for every page.
+
+=back
+
+In addition to setting these options, the TTSite helper also created the
+template and config files for us! In the 'root' directory, you'll notice
+two new directories: src and lib.
+
+Several configuration files in root/lib/config are called by PRE_PROCESS.
+
+The files in root/lib/site are the site-wide templates, called by
+WRAPPER, and display the html framework, control the layout, and provide
+the templates for the header and footer of your page. Using the template
+organization provided makes it much easier to standardize pages and make
+changes when they are (inevitably) needed.
+
+The template files that you will create for your application will go
+into root/src, and you don't need to worry about putting the the <html>
+or <head> sections; just put in the content. The WRAPPER will the rest
+of the page around your template for you.
+
+
+=head3 $c->stash
+
+Of course, having the template system include the header and footer for
+you isn't all that we want our templates to do. We need to be able to
+put data into our templates, and have it appear where and how we want
+it, right? That's where the stash comes in.
+
+In our controllers, we can add data to the stash, and then access it
+from the template. For instance:
+
+    sub hello : Local {
+        my ( $self, $c ) = @_;
+
+        $c->stash->{name} = 'Adam';
+
+        $c->stash->{template} = 'hello.tt';
+
+        $c->forward( $c->view('TT') );
+    }
+
+Then, in hello.tt:
+
+    <strong>Hello, [% name %]!</strong>
+
+When you view this page, it will display "Hello, Adam!"
+
+All of the information in your stash is available, by its name/key, in
+your templates. And your data don't have to be plain, old, boring
+scalars. You can pass array references and hash references, too.
+
+In your controller:
+
+    sub hello : Local {
+        my ( $self, $c ) = @_;
+
+        $c->stash->{names} = [ 'Adam', 'Dave', 'John' ];
+
+        $c->stash->{template} = 'hello.tt';
+
+        $c->forward( $c->view('TT') );
+    }
+
+In hello.tt:
+
+    [% FOREACH name IN names %]
+        <strong>Hello, [% name %]!</strong><br />
+    [% END %]
+
+This allowed us to loop through each item in the arrayref, and display a
+line for each name that we have.
+
+This is the most basic usage, but Template Toolkit is quite powerful,
+and allows you to truly keep your presentation logic separate from the
+rest of your application.
+
+=head3 $c->uri_for()
+
+One of my favorite things about Catalyst is the ability to move an
+application around without having to worry that everything is going to
+break. One of the areas that used to be a problem was with the http
+links in your template files. For example, suppose you have an
+application installed at http://www.domain.com/Calendar. The links point
+to "/Calendar", "/Calendar/2005", "/Calendar/2005/10", etc.  If you move
+the application to be at http://www.mydomain.com/Tools/Calendar, then
+all of those links will suddenly break.
+
+That's where $c->uri_for() comes in. This function will merge its
+parameters with either the base location for the app, or its current
+namespace. Let's take a look at a couple of examples.
+
+In your template, you can use the following:
+
+    <a href="[% c.uri_for('/login') %]">Login Here</a>
+
+Although the parameter starts with a forward slash, this is relative to the application root, not the webserver root. This is important to remember. So, if your application is installed at http://www.domain.com/Calendar, then the link would be http://www.mydomain.com/Calendar/Login. If you move your application to a different domain or path, then that link will still be correct.
+
+Likewise,
+
+    <a href="[% c.uri_for('2005','10', '24') %]">October, 24 2005</a>
+
+The first parameter does NOT have a forward slash, and so it will be relative to the current namespace. If the application is installed at http://www.domain.com/Calendar. and if the template is called from MyApp::Controller::Display, then the link would become http://www.domain.com/Calendar/Display/2005/10/24.
+
+Once again, this allows you to move your application around without having to worry about broken links. But there's something else, as well. Since the links are generated by uri_for, you can use the same template file by several different controllers, and each controller will get the links that its supposed to. Since we believe in Don't Repeat Yourself, this is particularly helpful if you have common elements in your site that you want to keep in one file.
+
+Further Reading:
+
+L<http://search.cpan.org/perldoc?Catalyst>
+
+L<http://search.cpan.org/perldoc?Catalyst%3A%3AView%3A%3ATT>
+
+L<http://search.cpan.org/perldoc?Template>
+
+=head2 Adding RSS feeds 
+
+Adding RSS feeds to your Catalyst applications is simple. We'll see two
+different aproaches here, but the basic premise is that you forward to
+the normal view action first to get the objects, then handle the output
+differently.
+
+=head3 Using TT templates
+
+This is the aproach used in Agave (L<http://dev.rawmode.org/>).
+
+    sub rss : Local {
+        my ($self,$c) = @_;
+        $c->forward('view');
+        $c->stash->{template}='rss.tt';
+    }
+
+Then you need a template. Here's the one from Agave: 
+
+    <?xml version="1.0" encoding="UTF-8"?>
+    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
+      <channel>
+       <title>[ [% blog.name || c.config.name || "Agave" %] ] RSS Feed</title>
+        <link>[% base %]</link>
+        <description>Recent posts</description>
+        <language>en-us</language>
+        <ttl>40</ttl>
+     [% WHILE (post = posts.next) %]
+      <item>
+        <title>[% post.title %]</title>
+        <description>[% post.formatted_teaser|html%]</description>    
+        <pubDate>[% post.pub_date %]</pubDate>
+        <guid>[% post.full_uri %]</guid>
+        <link>[% post.full_uri %]</link>
+        <dc:creator>[% post.author.screenname %]</dc:creator>
+      </item>
+    [% END %]
+      </channel>
+    </rss> 
+
+=head3 Using XML::Feed
+
+A more robust solution is to use XML::Feed, as was done in the Catalyst
+Advent Calendar. Assuming we have a C<view> action that populates
+'entries' with some DBIx::Class iterator, the code would look something
+like this:
+
+    sub rss : Local {
+        my ($self,$c) = @_;
+        $c->forward('view'); # get the entries
+
+        my $feed = XML::Feed->new('RSS');
+        $feed->title( $c->config->{name} . ' RSS Feed' );
+        $feed->link( $c->req->base ); # link to the site.
+        $feed->description('Catalyst advent calendar'); Some description
+
+        # Process the entries
+        while( my $entry = $c->stash->{entries}->next ) {
+            my $feed_entry = XML::Feed::Entry->new('RSS');
+            $feed_entry->title($entry->title);
+            $feed_entry->link( $c->uri_for($entry->link) );
+            $feed_entry->issued( DateTime->from_epoch(epoch => $entry->created) );
+            $feed->add_entry($feed_entry);
+        }
+        $c->res->body( $feed->as_xml );
+   }
+
+A little more code in the controller, but with this approach you're
+pretty sure to get something that validates. 
+
+Note that for both of the above aproaches, you'll need to set the
+content type like this:
+
+    $c->res->content_type('application/rss+xml');
+
+=head3 Final words
+
+You could generalize the second variant easily by replacing 'RSS' with a
+variable, so you can generate Atom feeds with the same code.
+
+Now, go ahead and make RSS feeds for all your stuff. The world *needs*
+updates on your goldfish!
+
+=head2 Forcing the browser to download content
+
+Sometimes you need your application to send content for download. For
+example, you can generate a comma-separated values (CSV) file for your
+users to download and import into their spreadsheet program.
+
+Let's say you have an C<Orders> controller which generates a CSV file
+in the C<export> action (i.e., C<http://localhost:3000/orders/export>):
+
+    sub export : Local Args(0) {
+        my ( $self, $c ) = @_;
+
+        # In a real application, you'd generate this from the database
+        my $csv = "1,5.99\n2,29.99\n3,3.99\n";
+
+        $c->res->content_type('text/comma-separated-values');
+        $c->res->body($csv);
+    }
+
+Normally the browser uses the last part of the URI to generate a
+filename for data it cannot display. In this case your browser would
+likely ask you to save a file named C<export>.
+
+Luckily you can have the browser download the content with a specific
+filename by setting the C<Content-Disposition> header:
+
+    my $filename = 'Important Orders.csv';
+    $c->res->header('Content-Disposition', qq[attachment; filename="$filename"]);
+
+Note the use of quotes around the filename; this ensures that any
+spaces in the filename are handled by the browser.
+
+Put this right before calling C<< $c->res->body >> and your browser
+will download a file named C<Important Orders.csv> instead of
+C<export>.
+
+You can also use this to have the browser download content which it
+normally displays, such as JPEG images or even HTML. Just be sure to
+set the appropriate content type and disposition.
+
+
+=head1 Controllers
+
+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<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.
+
+You can extend it like this:
+
+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:
+
+    sub end : ActionClass('RenderView') {
+      my ( $self, $c ) = @_;
+      # do stuff here; the RenderView action is called afterwards
+    }
+
+To add things to an C<end> action that are called I<after> 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
+
+A Catalyst application is driven by one or more Controller modules. There are
+a number of ways that Catalyst can decide which of the methods in your
+controller modules it should call. Controller methods are also called actions,
+because they determine how your catalyst application should (re-)act to any
+given URL. When the application is started up, catalyst looks at all your
+actions, and decides which URLs they map to.
+
+=head3 Type attributes
+
+Each action is a normal method in your controller, except that it has an
+L<attribute|http://search.cpan.org/~nwclark/perl-5.8.7/lib/attributes.pm>
+attached. These can be one of several types.
+
+Assume our Controller module starts with the following package declaration:
+
+ package MyApp::Controller::Buckets;
+
+and we are running our application on localhost, port 3000 (the test
+server default).
+
+=over 4
+
+=item Path
+
+A Path attribute also takes an argument, this can be either a relative
+or an absolute path. A relative path will be relative to the controller
+namespace, an absolute path will represent an exact matching URL.
+
+ sub my_handles : Path('handles') { .. }
+
+becomes
+
+ http://localhost:3000/buckets/handles
+
+and
+
+ sub my_handles : Path('/handles') { .. }
+
+becomes 
+
+ http://localhost:3000/handles
+
+=item Local
+
+When using a Local attribute, no parameters are needed, instead, the name of
+the action is matched in the URL. The namespaces created by the name of the
+controller package is always part of the URL.
+
+ sub my_handles : Local { .. }
+
+becomes
+
+ http://localhost:3000/buckets/my_handles
+
+=item Global
+
+A Global attribute is similar to a Local attribute, except that the namespace
+of the controller is ignored, and matching starts at root.
+
+ sub my_handles : Global { .. }
+
+becomes
+
+ http://localhost:3000/my_handles
+
+=item Regex
+
+By now you should have figured that a Regex attribute is just what it sounds
+like. This one takes a regular expression, and matches starting from
+root. These differ from the rest as they can match multiple URLs.
+
+ sub my_handles : Regex('^handles') { .. }
+
+matches
+
+ http://localhost:3000/handles
+
+and 
+
+ http://localhost:3000/handles_and_other_parts
+
+etc.
+
+=item LocalRegex
+
+A LocalRegex is similar to a Regex, except it only matches below the current
+controller namespace.
+
+ sub my_handles : LocalRegex(^handles') { .. }
+
+matches
+
+ http://localhost:3000/buckets/handles
+
+and
+
+ http://localhost:3000/buckets/handles_and_other_parts
+
+etc.
+
+=item Private
+
+Last but not least, there is the Private attribute, which allows you to create
+your own internal actions, which can be forwarded to, but won't be matched as
+URLs.
+
+ sub my_handles : Private { .. }
+
+becomes nothing at all..
+
+Catalyst also predefines some special Private actions, which you can override,
+these are:
+
+=over 4
+
+=item default
+
+The default action will be called, if no other matching action is found. If
+you don't have one of these in your namespace, or any sub part of your
+namespace, you'll get an error page instead. If you want to find out where it
+was the user was trying to go, you can look in the request object using 
+C<< $c->req->path >>.
+
+ sub default : Private { .. }
+
+works for all unknown URLs, in this controller namespace, or every one if put
+directly into MyApp.pm.
+
+=item index 
+
+The index action is called when someone tries to visit the exact namespace of
+your controller. If index, default and matching Path actions are defined, then
+index will be used instead of default and Path.
+
+ sub index : Private { .. }
+
+becomes
+
+ http://localhost:3000/buckets
+
+=item begin
+
+The begin action is called at the beginning of every request involving this
+namespace directly, before other matching actions are called. It can be used
+to set up variables/data for this particular part of your app. A single begin
+action is called, its always the one most relevant to the current namespace.
+
+ sub begin : Private { .. }
+
+is called once when 
+
+ http://localhost:3000/bucket/(anything)?
+
+is visited.
+
+=item end
+
+Like begin, this action is always called for the namespace it is in, after
+every other action has finished. It is commonly used to forward processing to
+the View component. A single end action is called, its always the one most
+relevant to the current namespace. 
+
+
+ sub end : Private { .. }
+
+is called once after any actions when
+
+ http://localhost:3000/bucket/(anything)?
+
+is visited.
+
+=item auto
+
+Lastly, the auto action is magic in that B<every> auto action in
+the chain of paths up to and including the ending namespace, will be
+called. (In contrast, only one of the begin/end/default actions will be
+called, the relevant one).
+
+ package MyApp.pm;
+ sub auto : Private { .. }
+
+and 
+
+ sub auto : Private { .. }
+
+will both be called when visiting 
+
+ http://localhost:3000/bucket/(anything)?
+
+=back
+
+=back
+
+=head3 A word of warning
+
+Due to possible namespace conflicts with Plugins, it is advised to only put the
+pre-defined Private actions in your main MyApp.pm file, all others should go
+in a Controller module.
+
+=head3 More Information
+
+L<http://search.cpan.org/author/SRI/Catalyst-5.61/lib/Catalyst/Manual/Intro.pod>
+
+L<http://dev.catalyst.perl.org/wiki/FlowChart>
+
+=head2 Component-based Subrequests
+
+See L<Catalyst::Plugin::SubRequest>.
+
+=head2 File uploads
+
+=head3 Single file upload with Catalyst
+
+To implement uploads in Catalyst, you need to have a HTML form similar to
+this:
+
+    <form action="/upload" method="post" enctype="multipart/form-data">
+      <input type="hidden" name="form_submit" value="yes">
+      <input type="file" name="my_file">
+      <input type="submit" value="Send">
+    </form>
+
+It's very important not to forget C<enctype="multipart/form-data"> in
+the form.
+
+Catalyst Controller module 'upload' action:
+
+    sub upload : Global {
+        my ($self, $c) = @_;
+
+        if ( $c->request->parameters->{form_submit} eq 'yes' ) {
+
+            if ( my $upload = $c->request->upload('my_file') ) {
+
+                my $filename = $upload->filename;
+                my $target   = "/tmp/upload/$filename";
+
+                unless ( $upload->link_to($target) || $upload->copy_to($target) ) {
+                    die( "Failed to copy '$filename' to '$target': $!" );
+                }
+            }
+        }
+
+        $c->stash->{template} = 'file_upload.html';
+    }
+
+=head3 Multiple file upload with Catalyst
+
+Code for uploading multiple files from one form needs a few changes:
+
+The form should have this basic structure:
+
+    <form action="/upload" method="post" enctype="multipart/form-data">
+      <input type="hidden" name="form_submit" value="yes">
+      <input type="file" name="file1" size="50"><br>
+      <input type="file" name="file2" size="50"><br>
+      <input type="file" name="file3" size="50"><br>
+      <input type="submit" value="Send">
+    </form>
+
+And in the controller:
+
+    sub upload : Local {
+        my ($self, $c) = @_;
+
+        if ( $c->request->parameters->{form_submit} eq 'yes' ) {
+
+            for my $field ( $c->req->upload ) {
+
+                my $upload   = $c->req->upload($field);
+                my $filename = $upload->filename;
+                my $target   = "/tmp/upload/$filename";
+
+                unless ( $upload->link_to($target) || $upload->copy_to($target) ) {
+                    die( "Failed to copy '$filename' to '$target': $!" );
+                }
+            }
+        }
+
+        $c->stash->{template} = 'file_upload.html';
+    }
+
+C<for my $field ($c-E<gt>req->upload)> loops automatically over all file
+input fields and gets input names. After that is basic file saving code,
+just like in single file upload.
+
+Notice: C<die>ing might not be what you want to do, when an error
+occurs, but it works as an example. A better idea would be to store
+error C<$!> in $c->stash->{error} and show a custom error template
+displaying this message.
+
+For more information about uploads and usable methods look at
+L<Catalyst::Request::Upload> and L<Catalyst::Request>.
+
+=head2 Forwarding with arguments
+
+Sometimes you want to pass along arguments when forwarding to another
+action. As of version 5.30, arguments can be passed in the call to
+C<forward>; in earlier versions, you can manually set the arguments in
+the Catalyst Request object:
+
+  # version 5.30 and later:
+  $c->forward('/wherever', [qw/arg1 arg2 arg3/]);
+
+  # pre-5.30
+  $c->req->args([qw/arg1 arg2 arg3/]);
+  $c->forward('/wherever');
+
+(See the L<Catalyst::Manual::Intro> Flow_Control section for more 
+information on passing arguments via C<forward>.)
+
+
+=head1 Deployment
+
+The recipes below describe aspects of the deployment process,
+including web server engines and tips to improve application efficiency.
+
+=head2 mod_perl Deployment
+
+mod_perl is the best solution for many applications, but we'll list some pros
+and cons so you can decide for yourself.  The other production deployment
+option is FastCGI, for which see below.
+
+=head3 Pros
+
+=head4 Speed
+
+mod_perl is very fast and your app will benefit from being loaded in memory
+within each Apache process.
+
+=head4 Shared memory for multiple apps
+
+If you need to run several Catalyst apps on the same server, mod_perl will
+share the memory for common modules.
+
+=head3 Cons
+
+=head4 Memory usage
+
+Since your application is fully loaded in memory, every Apache process will
+be rather large.  This means a large Apache process will be tied up while
+serving static files, large files, or dealing with slow clients.  For this
+reason, it is best to run a two-tiered web architecture with a lightweight
+frontend server passing dynamic requests to a large backend mod_perl
+server.
+
+=head4 Reloading
+
+Any changes made to the core code of your app require a full Apache restart.
+Catalyst does not support Apache::Reload or StatINC.  This is another good
+reason to run a frontend web server where you can set up an
+C<ErrorDocument 502> page to report that your app is down for maintenance.
+
+=head4 Cannot run multiple versions of the same app
+
+It is not possible to run two different versions of the same application in
+the same Apache instance because the namespaces will collide.
+
+=head4 Setup
+
+Now that we have that out of the way, let's talk about setting up mod_perl
+to run a Catalyst app.
+
+=head4 1. Install Catalyst::Engine::Apache
+
+You should install the latest versions of both Catalyst and 
+Catalyst::Engine::Apache.  The Apache engines were separated from the
+Catalyst core in version 5.50 to allow for updates to the engine without
+requiring a new Catalyst release.
+
+=head4 2. Install Apache with mod_perl
+
+Both Apache 1.3 and Apache 2 are supported, although Apache 2 is highly
+recommended.  With Apache 2, make sure you are using the prefork MPM and not
+the worker MPM.  The reason for this is that many Perl modules are not
+thread-safe and may have problems running within the threaded worker
+environment.  Catalyst is thread-safe however, so if you know what you're
+doing, you may be able to run using worker.
+
+In Debian, the following commands should get you going.
+
+    apt-get install apache2-mpm-prefork
+    apt-get install libapache2-mod-perl2
+
+=head4 3. Configure your application
+
+Every Catalyst application will automagically become a mod_perl handler
+when run within mod_perl.  This makes the configuration extremely easy.
+Here is a basic Apache 2 configuration.
+
+    PerlSwitches -I/var/www/MyApp/lib
+    PerlModule MyApp
+    
+    <Location />
+        SetHandler          modperl
+        PerlResponseHandler MyApp
+    </Location>
+
+The most important line here is C<PerlModule MyApp>.  This causes mod_perl
+to preload your entire application into shared memory, including all of your
+controller, model, and view classes and configuration.  If you have -Debug
+mode enabled, you will see the startup output scroll by when you first
+start Apache.
+
+For an example Apache 1.3 configuration, please see the documentation for
+L<Catalyst::Engine::Apache::MP13>.
+
+=head3 Test It
+
+That's it, your app is now a full-fledged mod_perl application!  Try it out
+by going to http://your.server.com/.
+
+=head3 Other Options
+
+=head4 Non-root location
+
+You may not always want to run your app at the root of your server or virtual
+host.  In this case, it's a simple change to run at any non-root location
+of your choice.
+
+    <Location /myapp>
+        SetHandler          modperl
+        PerlResponseHandler MyApp
+    </Location>
+    
+When running this way, it is best to make use of the C<uri_for> method in
+Catalyst for constructing correct links.
+
+=head4 Static file handling
+
+Static files can be served directly by Apache for a performance boost.
+
+    DocumentRoot /var/www/MyApp/root
+    <Location /static>
+        SetHandler default-handler
+    </Location>
+    
+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 Catalyst on shared hosting
+
+So, you want to put your Catalyst app out there for the whole world to
+see, but you don't want to break the bank. There is an answer - if you
+can get shared hosting with FastCGI and a shell, you can install your
+Catalyst app in a local directory on your shared host. First, run
+
+    perl -MCPAN -e shell
+
+and go through the standard CPAN configuration process. Then exit out
+without installing anything. Next, open your .bashrc and add
+
+    export PATH=$HOME/local/bin:$HOME/local/script:$PATH
+    perlversion=`perl -v | grep 'built for' | awk '{print $4}' | sed -e 's/v//;'`
+    export PERL5LIB=$HOME/local/share/perl/$perlversion:$HOME/local/lib/perl/$perlversion:$HOME/local/lib:$PERL5LIB
+
+and log out, then back in again (or run C<". .bashrc"> if you
+prefer). Finally, edit C<.cpan/CPAN/MyConfig.pm> and add
+
+    'make_install_arg' => qq[SITEPREFIX=$ENV{HOME}/local],
+    'makepl_arg' => qq[INSTALLDIRS=site install_base=$ENV{HOME}/local],
+
+Now you can install the modules you need using CPAN as normal; they
+will be installed into your local directory, and perl will pick them
+up. Finally, change directory into the root of your virtual host and
+symlink your application's script directory in:
+
+    cd path/to/mydomain.com
+    ln -s ~/lib/MyApp/script script
+
+And add the following lines to your .htaccess file (assuming the server
+is setup to handle .pl as fcgi - you may need to rename the script to
+myapp_fastcgi.fcgi and/or use a SetHandler directive):
+
+  RewriteEngine On
+  RewriteCond %{REQUEST_URI} !^/?script/myapp_fastcgi.pl
+  RewriteRule ^(.*)$ script/myapp_fastcgi.pl/$1 [PT,L]
+
+Now C<http://mydomain.com/> should now Just Work. Congratulations, now
+you can tell your friends about your new website (or in our case, tell
+the client it's time to pay the invoice :) )
+
+=head2 FastCGI Deployment
+
+FastCGI is a high-performance extension to CGI. It is suitable
+for production environments.
+
+=head3 Pros
+
+=head4 Speed
+
+FastCGI performs equally as well as mod_perl.  Don't let the 'CGI' fool you;
+your app runs as multiple persistent processes ready to receive connections
+from the web server.
+
+=head4 App Server
+
+When using external FastCGI servers, your application runs as a standalone
+application server.  It may be restarted independently from the web server.
+This allows for a more robust environment and faster reload times when
+pushing new app changes.  The frontend server can even be configured to
+display a friendly "down for maintenance" page while the application is
+restarting.
+
+=head4 Load-balancing
+
+You can launch your application on multiple backend servers and allow the
+frontend web server to load-balance between all of them.  And of course, if
+one goes down, your app continues to run fine.
+
+=head4 Multiple versions of the same app
+
+Each FastCGI application is a separate process, so you can run different
+versions of the same app on a single server.
+
+=head4 Can run with threaded Apache
+
+Since your app is not running inside of Apache, the faster mpm_worker module
+can be used without worrying about the thread safety of your application.
+
+=head3 Cons
+
+=head4 More complex environment
+
+With FastCGI, there are more things to monitor and more processes running
+than when using mod_perl.
+
+=head3 Setup
+
+=head4 1. Install Apache with mod_fastcgi
+
+mod_fastcgi for Apache is a third party module, and can be found at
+L<http://www.fastcgi.com/>.  It is also packaged in many distributions,
+for example, libapache2-mod-fastcgi in Debian.
+
+=head4 2. Configure your application
+
+    # Serve static content directly
+    DocumentRoot  /var/www/MyApp/root
+    Alias /static /var/www/MyApp/root/static
+
+    FastCgiServer /var/www/MyApp/script/myapp_fastcgi.pl -processes 3
+    Alias /myapp/ /var/www/MyApp/script/myapp_fastcgi.pl/
+    
+    # Or, run at the root
+    Alias / /var/www/MyApp/script/myapp_fastcgi.pl/
+    
+The above commands will launch 3 app processes and make the app available at
+/myapp/
+
+=head3 Standalone server mode
+
+While not as easy as the previous method, running your app as an external
+server gives you much more flexibility.
+
+First, launch your app as a standalone server listening on a socket.
+
+    script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5 -p /tmp/myapp.pid -d
+    
+You can also listen on a TCP port if your web server is not on the same
+machine.
+
+    script/myapp_fastcgi.pl -l :8080 -n 5 -p /tmp/myapp.pid -d
+    
+You will probably want to write an init script to handle starting/stopping
+of the app using the pid file.
+
+Now, we simply configure Apache to connect to the running server.
+
+    # 502 is a Bad Gateway error, and will occur if the backend server is down
+    # This allows us to display a friendly static page that says "down for
+    # maintenance"
+    Alias /_errors /var/www/MyApp/root/error-pages
+    ErrorDocument 502 /_errors/502.html
+
+    FastCgiExternalServer /tmp/myapp -socket /tmp/myapp.socket
+    Alias /myapp/ /tmp/myapp/
+    
+    # Or, run at the root
+    Alias / /tmp/myapp/
+    
+=head3 More Info
+
+L<Catalyst::Engine::FastCGI>.
+
+=head2 Development server deployment
+
+The development server is a mini web server written in perl.  If you
+expect a low number of hits or you don't need mod_perl/FastCGI speed,
+you could use the development server as the application server with a
+lightweight proxy web server at the front.  However, be aware that
+there are known issues, especially with Internet Explorer.  Many of
+these issues can be dealt with by running the server with the -k
+(keepalive) option but be aware for more complex applications this may
+not be suitable.  Consider using Catalyst::Engine::HTTP::POE.  This
+recipe is easily adapted for POE as well.
+
+=head3 Pros
+
+As this is an application server setup, the pros are the same as
+FastCGI (with the exception of speed).
+It is also:
+
+=head4 Simple
+
+The development server is what you create your code on, so if it works
+here, it should work in production!
+
+=head3 Cons
+
+=head4 Speed
+
+Not as fast as mod_perl or FastCGI. Needs to fork for each request
+that comes in - make sure static files are served by the web server to
+save forking.
+
+=head3 Setup
+
+=head4 Start up the development server
+
+   script/myapp_server.pl -p 8080 -k  -f -pidfile=/tmp/myapp.pid -daemon
+
+You will probably want to write an init script to handle stop/starting
+the app using the pid file.
+
+=head4 Configuring Apache
+
+Make sure mod_proxy is enabled and add:
+
+    # Serve static content directly
+    DocumentRoot /var/www/MyApp/root
+    Alias /static /var/www/MyApp/root/static
+
+    ProxyRequests Off
+    <Proxy *>
+        Order deny,allow
+        Allow from all
+    </Proxy>
+    ProxyPass / http://localhost:8080/
+    ProxyPassReverse / http://localhost:8080/
+
+You can wrap the above within a VirtualHost container if you want
+different apps served on the same host.
+
+=head2 Quick deployment: Building PAR Packages
+
+You have an application running on your development box, but then you
+have to quickly move it to another one for
+demonstration/deployment/testing...
+
+PAR packages can save you from a lot of trouble here. They are usual Zip
+files that contain a blib tree; you can even include all prereqs and a
+perl interpreter by setting a few flags!
+
+=head3 Follow these few points to try it out!
+
+1. Install Catalyst and PAR 0.89 (or later)
+
+    % perl -MCPAN -e 'install Catalyst'
+    ...
+    % perl -MCPAN -e 'install PAR'
+    ...
+
+2. Create a application
+
+    % catalyst.pl MyApp
+    ...
+    % cd MyApp
+
+Recent versions of Catalyst (5.62 and up) include
+L<Module::Install::Catalyst>, which simplifies the process greatly.  From the shell in your application directory:
+
+    % perl Makefile.PL
+    % make catalyst_par
+
+Congratulations! Your package "myapp.par" is ready, the following
+steps are just optional.
+
+3. Test your PAR package with "parl" (no typo)
+
+    % parl myapp.par
+    Usage:
+        [parl] myapp[.par] [script] [arguments]
+
+      Examples:
+        parl myapp.par myapp_server.pl -r
+        myapp myapp_cgi.pl
+
+      Available scripts:
+        myapp_cgi.pl
+        myapp_create.pl
+        myapp_fastcgi.pl
+        myapp_server.pl
+        myapp_test.pl
+
+    % parl myapp.par myapp_server.pl
+    You can connect to your server at http://localhost:3000
+
+Yes, this nifty little starter application gets automatically included.
+You can also use "catalyst_par_script('myapp_server.pl')" to set a
+default script to execute.
+
+6. Want to create a binary that includes the Perl interpreter?
+
+    % pp -o myapp myapp.par
+    % ./myapp myapp_server.pl
+    You can connect to your server at http://localhost:3000
+
+=head2 Serving static content
+
+Serving static content in Catalyst used to be somewhat tricky; the use
+of L<Catalyst::Plugin::Static::Simple> makes everything much easier.
+This plugin will automatically serve your static content during development,
+but allows you to easily switch to Apache (or other server) in a
+production environment.
+
+=head3 Introduction to Static::Simple
+
+Static::Simple is a plugin that will help to serve static content for your
+application. By default, it will serve most types of files, excluding some
+standard Template Toolkit extensions, out of your B<root> file directory. All
+files are served by path, so if B<images/me.jpg> is requested, then
+B<root/images/me.jpg> is found and served.
+
+=head3 Usage
+
+Using the plugin is as simple as setting your use line in MyApp.pm to include:
+
+ use Catalyst qw/Static::Simple/;
+
+and already files will be served.
+
+=head3 Configuring
+
+Static content is best served from a single directory within your root
+directory. Having many different directories such as C<root/css> and
+C<root/images> requires more code to manage, because you must separately
+identify each static directory--if you decide to add a C<root/js>
+directory, you'll need to change your code to account for it. In
+contrast, keeping all static directories as subdirectories of a main
+C<root/static> directory makes things much easier to manage. Here's an
+example of a typical root directory structure:
+
+    root/
+    root/content.tt
+    root/controller/stuff.tt
+    root/header.tt
+    root/static/
+    root/static/css/main.css
+    root/static/images/logo.jpg
+    root/static/js/code.js
+
+
+All static content lives under C<root/static>, with everything else being
+Template Toolkit files.
+
+=over 4
+
+=item Include Path
+
+You may of course want to change the default locations, and make
+Static::Simple look somewhere else, this is as easy as:
+
+ MyApp->config->{static}->{include_path} = [
+  MyApp->config->{root},
+  '/path/to/my/files' 
+ ];
+
+When you override include_path, it will not automatically append the
+normal root path, so you need to add it yourself if you still want
+it. These will be searched in order given, and the first matching file
+served.
+
+=item Static directories
+
+If you want to force some directories to be only static, you can set
+them using paths relative to the root dir, or regular expressions:
+
+ MyApp->config->{static}->{dirs} = [
+   'static',
+   qr/^(images|css)/,
+ ];
+
+=item File extensions
+
+By default, the following extensions are not served (that is, they will
+be processed by Catalyst): B<tmpl, tt, tt2, html, xhtml>. This list can
+be replaced easily:
+
+ MyApp->config->{static}->{ignore_extensions} = [
+    qw/tmpl tt tt2 html xhtml/ 
+ ];
+
+=item Ignoring directories
+
+Entire directories can be ignored. If used with include_path,
+directories relative to the include_path dirs will also be ignored:
+
+ MyApp->config->{static}->{ignore_dirs} = [ qw/tmpl css/ ];
+
+=back
+
+=head3 More information
+
+L<http://search.cpan.org/dist/Catalyst-Plugin-Static-Simple/>
+
+=head3 Serving manually with the Static plugin with HTTP::Daemon (myapp_server.pl)
+
+In some situations you might want to control things more directly,
+using L<Catalyst::Plugin::Static>.
+
+In your main application class (MyApp.pm), load the plugin:
+
+    use Catalyst qw/-Debug FormValidator Static OtherPlugin/;
+
+You will also need to make sure your end method does I<not> forward
+static content to the view, perhaps like this:
+
+    sub end : Private {
+        my ( $self, $c ) = @_;
+
+        $c->forward( 'MyApp::View::TT' ) 
+          unless ( $c->res->body || !$c->stash->{template} );
+    }
+
+This code will only forward to the view if a template has been
+previously defined by a controller and if there is not already data in
+C<$c-E<gt>res-E<gt>body>.
+
+Next, create a controller to handle requests for the /static path. Use
+the Helper to save time. This command will create a stub controller as
+C<lib/MyApp/Controller/Static.pm>.
+
+    $ script/myapp_create.pl controller Static
+
+Edit the file and add the following methods:
+
+    # serve all files under /static as static files
+    sub default : Path('/static') {
+        my ( $self, $c ) = @_;
+
+        # Optional, allow the browser to cache the content
+        $c->res->headers->header( 'Cache-Control' => 'max-age=86400' );
+
+        $c->serve_static; # from Catalyst::Plugin::Static
+    }
+
+    # also handle requests for /favicon.ico
+    sub favicon : Path('/favicon.ico') {
+        my ( $self, $c ) = @_;
+
+        $c->serve_static;
+    }
+
+You can also define a different icon for the browser to use instead of
+favicon.ico by using this in your HTML header:
+
+    <link rel="icon" href="/static/myapp.ico" type="image/x-icon" />
+
+=head3 Common problems with the Static plugin
+
+The Static plugin makes use of the C<shared-mime-info> package to
+automatically determine MIME types. This package is notoriously
+difficult to install, especially on win32 and OS X. For OS X the easiest
+path might be to install Fink, then use C<apt-get install
+shared-mime-info>. Restart the server, and everything should be fine.
+
+Make sure you are using the latest version (>= 0.16) for best
+results. If you are having errors serving CSS files, or if they get
+served as text/plain instead of text/css, you may have an outdated
+shared-mime-info version. You may also wish to simply use the following
+code in your Static controller:
+
+    if ($c->req->path =~ /css$/i) {
+        $c->serve_static( "text/css" );
+    } else {
+        $c->serve_static;
+    }
+
+=head3 Serving Static Files with Apache
+
+When using Apache, you can bypass Catalyst and any Static
+plugins/controllers controller by intercepting requests for the
+C<root/static> path at the server level. All that is required is to
+define a DocumentRoot and add a separate Location block for your static
+content. Here is a complete config for this application under mod_perl
+1.x:
+
+    <Perl>
+        use lib qw(/var/www/MyApp/lib);
+    </Perl>
+    PerlModule MyApp
+
+    <VirtualHost *>
+        ServerName myapp.example.com
+        DocumentRoot /var/www/MyApp/root
+        <Location />
+            SetHandler perl-script
+            PerlHandler MyApp
+        </Location>
+        <LocationMatch "/(static|favicon.ico)">
+            SetHandler default-handler
+        </LocationMatch>
+    </VirtualHost>
+
+And here's a simpler example that'll get you started:
+
+    Alias /static/ "/my/static/files/"
+    <Location "/static">
+        SetHandler none
+    </Location>
+
+=head2 Caching
+
+Catalyst makes it easy to employ several different types of caching to
+speed up your applications.
+
+=head3 Cache Plugins
+
+There are three wrapper plugins around common CPAN cache modules:
+Cache::FastMmap, Cache::FileCache, and Cache::Memcached.  These can be
+used to cache the result of slow operations.
+
+This very page you're viewing makes use of the FileCache plugin to cache the
+rendered XHTML version of the source POD document.  This is an ideal
+application for a cache because the source document changes infrequently but
+may be viewed many times.
+
+    use Catalyst qw/Cache::FileCache/;
+    
+    ...
+    
+    use File::stat;
+    sub render_pod : Local {
+        my ( self, $c ) = @_;
+        
+        # the cache is keyed on the filename and the modification time
+        # to check for updates to the file.
+        my $file  = $c->path_to( 'root', '2005', '11.pod' );
+        my $mtime = ( stat $file )->mtime;
+        
+        my $cached_pod = $c->cache->get("$file $mtime");
+        if ( !$cached_pod ) {
+            $cached_pod = do_slow_pod_rendering();
+            # cache the result for 12 hours
+            $c->cache->set( "$file $mtime", $cached_pod, '12h' );
+        }
+        $c->stash->{pod} = $cached_pod;
+    }
+    
+We could actually cache the result forever, but using a value such as 12 hours
+allows old entries to be automatically expired when they are no longer needed.
+
+=head3 Page Caching
+
+Another method of caching is to cache the entire HTML page.  While this is
+traditionally handled by a front-end proxy server like Squid, the Catalyst
+PageCache plugin makes it trivial to cache the entire output from
+frequently-used or slow actions.
+
+Many sites have a busy content-filled front page that might look something
+like this.  It probably takes a while to process, and will do the exact same
+thing for every single user who views the page.
+
+    sub front_page : Path('/') {
+        my ( $self, $c ) = @_;
+        
+        $c->forward( 'get_news_articles' );
+        $c->forward( 'build_lots_of_boxes' );
+        $c->forward( 'more_slow_stuff' );
+        
+        $c->stash->{template} = 'index.tt';
+    }
+
+We can add the PageCache plugin to speed things up.
+
+    use Catalyst qw/Cache::FileCache PageCache/;
+    
+    sub front_page : Path ('/') {
+        my ( $self, $c ) = @_;
+        
+        $c->cache_page( 300 );
+        
+        # same processing as above
+    }
+    
+Now the entire output of the front page, from <html> to </html>, will be
+cached for 5 minutes.  After 5 minutes, the next request will rebuild the
+page and it will be re-cached.
+
+Note that the page cache is keyed on the page URI plus all parameters, so
+requests for / and /?foo=bar will result in different cache items.  Also,
+only GET requests will be cached by the plugin.
+
+You can even get that front-end Squid proxy to help out by enabling HTTP
+headers for the cached page.
+
+    MyApp->config->{page_cache}->{set_http_headers} = 1;
+    
+This would now set the following headers so proxies and browsers may cache
+the content themselves.
+
+    Cache-Control: max-age=($expire_time - time)
+    Expires: $expire_time
+    Last-Modified: $cache_created_time
+    
+=head3 Template Caching
+
+Template Toolkit provides support for caching compiled versions of your
+templates.  To enable this in Catalyst, use the following configuration.
+TT will cache compiled templates keyed on the file mtime, so changes will
+still be automatically detected.
+
+    package MyApp::View::TT;
+    
+    use strict;
+    use warnings;
+    use base 'Catalyst::View::TT';
+    
+    __PACKAGE__->config(
+        COMPILE_DIR => '/tmp/template_cache',
+    );
+    
+    1;
+    
+=head3 More Info
+
+See the documentation for each cache plugin for more details and other
+available configuration options.
+
+L<Catalyst::Plugin::Cache::FastMmap>
+L<Catalyst::Plugin::Cache::FileCache>
+L<Catalyst::Plugin::Cache::Memcached>
+L<Catalyst::Plugin::PageCache>
+L<http://search.cpan.org/dist/Template-Toolkit/lib/Template/Manual/Config.pod#Caching_and_Compiling_Options>
+
+=head1 Testing
+
+Testing is an integral part of the web application development
+process.  Tests make multi developer teams easier to coordinate, and
+they help ensure that there are no nasty surprises after upgrades or
+alterations.
+
+=head2 Testing
+
+Catalyst provides a convenient way of testing your application during 
+development and before deployment in a real environment.
+
+C<Catalyst::Test> makes it possible to run the same tests both locally 
+(without an external daemon) and against a remote server via HTTP.
+
+=head3 Tests
+
+Let's examine a skeleton application's C<t/> directory:
+
+    mundus:~/MyApp chansen$ ls -l t/
+    total 24
+    -rw-r--r--  1 chansen  chansen   95 18 Dec 20:50 01app.t
+    -rw-r--r--  1 chansen  chansen  190 18 Dec 20:50 02pod.t
+    -rw-r--r--  1 chansen  chansen  213 18 Dec 20:50 03podcoverage.t
+
+=over 4
+
+=item C<01app.t>
+
+Verifies that the application loads, compiles, and returns a successful
+response.
+
+=item C<02pod.t>
+
+Verifies that all POD is free from errors. Only executed if the C<TEST_POD> 
+environment variable is true.
+
+=item C<03podcoverage.t>
+
+Verifies that all methods/functions have POD coverage. Only executed if the
+C<TEST_POD> environment variable is true.
+
+=back
+
+=head3 Creating tests
+
+    mundus:~/MyApp chansen$ cat t/01app.t | perl -ne 'printf( "%2d  %s", $., $_ )'
+    1  use Test::More tests => 2;
+    2  use_ok( Catalyst::Test, 'MyApp' );
+    3
+    4  ok( request('/')->is_success );
+
+The first line declares how many tests we are going to run, in this case
+two. The second line tests and loads our application in test mode. The
+fourth line verifies that our application returns a successful response.
+
+C<Catalyst::Test> exports two functions, C<request> and C<get>. Each can
+take three different arguments:
+
+=over 4
+
+=item A string which is a relative or absolute URI.
+
+    request('/my/path');
+    request('http://www.host.com/my/path');
+
+=item An instance of C<URI>.
+
+    request( URI->new('http://www.host.com/my/path') );
+
+=item An instance of C<HTTP::Request>.
+
+    request( HTTP::Request->new( GET => 'http://www.host.com/my/path') );
+
+=back
+
+C<request> returns an instance of C<HTTP::Response> and C<get> returns the 
+content (body) of the response.
+
+=head3 Running tests locally
+
+    mundus:~/MyApp chansen$ CATALYST_DEBUG=0 TEST_POD=1 prove --lib lib/ t/
+    t/01app............ok                                                        
+    t/02pod............ok                                                        
+    t/03podcoverage....ok                                                        
+    All tests successful.
+    Files=3, Tests=4,  2 wallclock secs ( 1.60 cusr +  0.36 csys =  1.96 CPU)
+C<CATALYST_DEBUG=0> ensures that debugging is off; if it's enabled you
+will see debug logs between tests.
+
+C<TEST_POD=1> enables POD checking and coverage.
+
+C<prove> A command-line tool that makes it easy to run tests. You can
+find out more about it from the links below.
+
+=head3 Running tests remotely
+
+    mundus:~/MyApp chansen$ CATALYST_SERVER=http://localhost:3000/ prove --lib lib/ t/01app.t
+    t/01app....ok                                                                
+    All tests successful.
+    Files=1, Tests=2,  0 wallclock secs ( 0.40 cusr +  0.01 csys =  0.41 CPU)
+
+C<CATALYST_SERVER=http://localhost:3000/> is the absolute deployment URI of 
+your application. In C<CGI> or C<FastCGI> it should be the host and path 
+to the script.
+
+=head3 C<Test::WWW::Mechanize> and Catalyst
+
+Be sure to check out C<Test::WWW::Mechanize::Catalyst>. It makes it easy to
+test HTML, forms and links. A short example of usage:
+
+    use Test::More tests => 6;
+    use_ok( Test::WWW::Mechanize::Catalyst, 'MyApp' );
+
+    my $mech = Test::WWW::Mechanize::Catalyst->new;
+    $mech->get_ok("http://localhost/", 'Got index page');
+    $mech->title_like( qr/^MyApp on Catalyst/, 'Got right index title' );
+    ok( $mech->find_link( text_regex => qr/^Wiki/i ), 'Found link to Wiki' );
+    ok( $mech->find_link( text_regex => qr/^Mailing-List/i ), 'Found link to Mailing-List' );
+    ok( $mech->find_link( text_regex => qr/^IRC channel/i ), 'Found link to IRC channel' );
+
+=head3 Further Reading
+
+=over 4
+
+=item Catalyst::Test
+
+L<http://search.cpan.org/dist/Catalyst/lib/Catalyst/Test.pm>
+
+=item Test::WWW::Mechanize::Catalyst
+
+L<http://search.cpan.org/dist/Test-WWW-Mechanize-Catalyst/lib/Test/WWW/Mechanize/Catalyst.pm>
+
+=item Test::WWW::Mechanize
+
+L<http://search.cpan.org/dist/Test-WWW-Mechanize/Mechanize.pm>
+
+=item WWW::Mechanize
+
+L<http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm>
+
+=item LWP::UserAgent
+
+L<http://search.cpan.org/dist/libwww-perl/lib/LWP/UserAgent.pm>
+
+=item HTML::Form
+
+L<http://search.cpan.org/dist/libwww-perl/lib/HTML/Form.pm>
+
+=item HTTP::Message
+
+L<http://search.cpan.org/dist/libwww-perl/lib/HTTP/Message.pm>
+
+=item HTTP::Request
+
+L<http://search.cpan.org/dist/libwww-perl/lib/HTTP/Request.pm>
+
+=item HTTP::Request::Common
+
+L<http://search.cpan.org/dist/libwww-perl/lib/HTTP/Request/Common.pm>
+
+=item HTTP::Response
+
+L<http://search.cpan.org/dist/libwww-perl/lib/HTTP/Response.pm>
+
+=item HTTP::Status
+
+L<http://search.cpan.org/dist/libwww-perl/lib/HTTP/Status.pm>
+
+=item URI
+
+L<http://search.cpan.org/dist/URI/URI.pm>
+
+=item Test::More
+
+L<http://search.cpan.org/dist/Test-Simple/lib/Test/More.pm>
+
+=item Test::Pod
+
+L<http://search.cpan.org/dist/Test-Pod/Pod.pm>
+
+=item Test::Pod::Coverage
+
+L<http://search.cpan.org/dist/Test-Pod-Coverage/Coverage.pm>
+
+=item prove (Test::Harness)
+
+L<http://search.cpan.org/dist/Test-Harness/bin/prove>
+
+=back
+
+=head3 More Information
+
+L<http://search.cpan.org/perldoc?Catalyst::Plugin::Authorization::Roles>
+L<http://search.cpan.org/perldoc?Catalyst::Plugin::Authorization::ACL>
+
+=head1 AUTHORS
+
+Sebastian Riedel C<sri@oook.de>
+
+Danijel Milicevic C<me@danijel.de>
+
+Viljo Marrandi C<vilts@yahoo.com>  
+
+Marcus Ramberg C<mramberg@cpan.org>
+
+Jesse Sheidlower C<jester@panix.com>
+
+Andy Grundman C<andy@hybridized.org> 
+
+Chisel Wright C<pause@herlpacker.co.uk>
+
+Will Hawes C<info@whawes.co.uk>
+
+Gavin Henry C<ghenry@perl.me.uk>
+
+Kieren Diment C<kd@totaldatasolution.com>
+
+=head1 COPYRIGHT
+
+This document is free, you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
diff --git a/lib/Catalyst/Manual/DevelopmentProcess.pod b/lib/Catalyst/Manual/DevelopmentProcess.pod
new file mode 100644 (file)
index 0000000..a474904
--- /dev/null
@@ -0,0 +1,92 @@
+=head1 NAME
+
+Catalyst::Manual::DevelopmentProcess - Administrative structure of the Catalyst Development Process
+
+=head1 Aims of the Catalyst Core Team
+
+The main current goals of the Catalyst core development team continue to
+be stability, performance, and a more paced addition of features, with a
+focus on extensibility. Extensive improvements to the documentation are
+also expected in the short term.
+
+The Catalyst Roadmap at L<http://dev.catalyst.perl.org/roadmap> will
+remain as is, and continues to reflect the specific priorities and
+schedule for future releases.
+
+=head1 Charter for the Catalyst Core Team
+
+=head2 Intention
+
+The intention of the Catalyst Core Team is to maintain and support the
+Catalyst framework, in order for it to be a viable and stable framework
+for developing web-based MVC applications. This includes both technical
+decisions about the Catalyst core distribution, and public relations
+relating to the Catalyst framework as a whole.
+
+The main priority for development is stability for the users of the
+framework, while improving usability and extensibility, as well as
+improving documentation and ease of deployment.
+
+=head2 Membership
+
+The Catalyst Core Team consists of the developers that have full commit
+privileges to the entire Catalyst source tree. 
+
+In addition, the core team may accept members that have non-technical
+roles such as marketing, legal, or economic responsibilities.
+
+At the time of conception, the Core Team consists of the following people:
+
+=over 4
+
+=item Andy Grundman
+
+=item Christian Hansen
+
+=item Brian Cassidy
+
+=item Marcus Ramberg
+
+=item Jesse Sheidlower
+
+=item Matt S. Trout
+
+=item Yuval Kogman
+
+=back
+
+New members of the Core Team must be accepted by a 2/3 majority by the
+current members.
+
+=head2 Technical Decisions.
+
+Any change to the Catalyst core which can not be conceived as a
+correction of an error in the current feature set will need to be
+accepted by at least 3 members of the Core Team before it can be
+commited to the trunk (which is the basis for CPAN releases). Anyone
+with access is at any time free to make a branch to develop a proof of
+concept for a feature to be committed to trunk.
+
+=head2 Organizational and Philosophical Decisions.
+
+Any such decision should be decided by majority vote. Thus it should be
+a goal of the organization that its membership number should at any time
+be an odd number, to render it effective with regards to decision
+making. The exceptions to this rule are changes to this charter and
+additions to the membership of the Core Team, which require a 2/3
+majority.
+
+=head2 CPAN Releases
+
+Planned releases to CPAN should be performed by the release manager, at
+the time of writing Marcus Ramberg, or the deputy release manager, at
+the time of writing Andy Grundman. In the case of critical error
+correction, any member of the Core Team can perform a rescue release.
+
+=head2 Public statements from the Core Team
+
+The Core Team should strive to appear publicly as a group when answering
+questions or other correspondence. In cases where this is not possible,
+the same order as for CPAN Releases applies.
+
+
diff --git a/lib/Catalyst/Manual/Installation.pod b/lib/Catalyst/Manual/Installation.pod
new file mode 100644 (file)
index 0000000..6fc70d9
--- /dev/null
@@ -0,0 +1,152 @@
+=head1 NAME
+
+Catalyst::Manual::Installation - Catalyst Installation
+
+=head1 DESCRIPTION
+
+How to install Catalyst.
+
+=head1 INSTALLATION
+
+One of the frequent problems reported by new users of Catalyst is that
+it can be extremely time-consuming and difficult to install.
+
+One of the great strengths of Perl as a programming language is its use
+of CPAN, the Comprehensive Perl Archive Network, an enormous global
+repository containing over 10,000 free modules.  For almost any basic
+task--and a very large number of non-basic ones--there is a module on
+CPAN that will help you. Catalyst has taken advantage of this, and uses
+a very large number of CPAN modules, rather than reinventing the wheel
+over and over again.  On the one hand, Catalyst gains power and
+flexibility through this re-use of existing code. On the other hand,
+Catalyst's reliance on CPAN can complicate initial installations,
+especially in shared-hosting environments where you, the user, do not
+have easy control over what versions of other modules are installed.
+
+It is worth stressing that the difficulties found in installing Catalyst
+are caused not by anything intrinsic to Catalyst itself, but rather by
+the interrelated dependencies of a large number of required modules.
+
+Fortunately, there are a growing number of methods that can dramatically
+ease this undertaking. Note that for many of these, you will probably
+need to install additional Catalyst-related modules (especially plugins)
+to do the things you want. As of version 5.70, Catalyst has split into
+two packages, L<Catalyst::Runtime>, which includes the core elements
+necessary to deploy a Catalyst application, and L<Catalyst::Devel>,
+which includes the Helpers and other things necessary or useful for
+developing Catalyst applications.  In a purely deployment environment
+you can omit L<Catalyst::Devel>.
+
+=over 4
+
+=item * 
+
+Matt Trout's C<cat-install> script
+
+Available at L<http://www.shadowcatsystems.co.uk/static/cat-install>,
+C<cat-install> can be a quick and painless way to get Catalyst up and
+running on your system.  Just download the script from the link above
+and type C<perl cat-install>. This script automates the process of
+installing Catalyst itself and its dependencies, with bits of overriding
+so that the process does not require user interaction. C<cat-install>
+installs Catalyst and its dependencies using the L<CPAN> module, so that
+modules are installed the same way you would probably install them
+normally--it just makes it easier. This is a recommended solution for
+installation.
+
+=item * 
+
+Chris Laco's CatInABox
+
+CatInABox is a complete version of Catalyst that is installed locally on
+your system, so that you don't need to go through the effort of doing a
+full install. Simply download the tarball from
+L<http://handelframework.com/downloads/CatInABox.tar.gz> and unpack it
+on your machine.  Depending on your OS platform, either run C<start.bat>
+or C<start.sh> to set your bin/PERLLIB paths. This tarball contains
+everything needed to try out Catalyst including Catalyst itself,
+Template Toolkit, several Authentication modules, StackTrace, and a few
+other plugins.
+
+A special Win32 version is available upon request that contains many
+more plugins and pre-compiled modules, including DBIx::Class, DBI,
+SQLite, and Session support. If you are interested in this version,
+please send e-mail to C<claco@chrislaco.com>.
+
+=item * 
+
+Pre-Built VMWare Images
+
+Under the VMWare community program, work is ongoing to develop a number
+of VMWare images where an entire Catalyst development environment has
+already been installed, complete with database engines and a full
+complement of Catalyst plugins.
+
+=back
+
+=head2 OTHER METHODS
+
+In addition to the "all-in-one" approaches mentioned above, there are a
+variety of other installation techniques:
+
+=over 4
+
+=item * 
+
+CPAN
+
+The traditional way to install Catalyst is directly from CPAN using the
+C<Task::Catalyst> bundle and C<Catalyst::Devel>:
+
+       $ perl -MCPAN -e 'install Task::Catalyst'
+       $ perl -MCPAN -e 'install Catalyst::Devel'
+
+Unless you have a particularly complete set of Perl modules already
+installed, be prepared for a large number of nested dependencies.
+
+=item * 
+
+Gentoo Linux
+
+For users of Gentoo, see
+C<http://gentoo-wiki.com/HOWTO_Catalyst_Framework> for automated
+installations.  In short, simply mount the portage overlay and type
+C<emerge catalystframework>.
+
+=item * 
+
+FreeBSD
+
+FreeBSD users can get up and running quickly by typing C<cd
+/usr/ports/www/p5-Catalyst && make install>, or C<portinstall
+p5-Catalyst> if C<portinstall> is installed on your system.
+
+=item * 
+
+Windows ActivePerl
+
+Windows users can take advantage of the PPM tool that comes with
+ActivePerl to jumpstart their Catalyst environment.  Directions are
+available at L<http://catalyst.infogami.com/katalytes/cat_on_windows>.
+
+=item *
+
+Subversion Repository
+
+Catalyst uses Subversion for version control. To checkout the latest:
+
+    $ svn co http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/
+
+=back
+
+B<NOTE:> Although all of the above methods can be used to install a base
+Catalyst system, only the VMWare image is likely to have all of the
+plugins and modules you need to use Catalyst properly.  When you start
+the C<script/myapp_server.pl> development server, it will tell you about
+any modules that are missing.  To add them, type something along the
+lines of the following (C<Catalyst::Model::DBIC::Schema> is used here as
+a representative example):
+
+    # perl -MCPAN -e 'install Catalyst::Model::DBIC::Schema'
+    ...
+
diff --git a/lib/Catalyst/Manual/Installation/CentOS4.pod b/lib/Catalyst/Manual/Installation/CentOS4.pod
new file mode 100644 (file)
index 0000000..7fca29b
--- /dev/null
@@ -0,0 +1,378 @@
+=head1 NAME
+
+Catalyst::Manual::Installation::CentOS4 - Catalyst Installation on CentOS 4
+
+
+
+=head1 DESCRIPTION
+
+This document provides directions on how to install CentOS 4 (a rebuild
+of RedHat Enterprise 4) and then install Catalyst.
+
+If you already have a functioning install of CentOS, RHEL, or a
+comparable Linux OS, you should be able to skip this first section and
+go straight to the C<INSTALL CATALYST> section.
+
+B<NOTE:> You might want to consult the latest version of this document.  It
+is available at:
+L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Installation/CentOS4.pod>
+
+
+
+=head1 INSTALL CENTOS
+
+These directions are written for CentOS 4.4 on an i386 machine; however,
+you can substitute other versions as they become available.
+
+
+=over 4
+
+=item * 
+
+Go to L<http://isoredirect.centos.org/centos/4/isos/i386/> and click the
+nearest mirror.
+
+=item * 
+
+Download C<CentOS-4.4-i386-bin1of4.iso> (you only need the first disk).
+
+=item * 
+
+Burn the .iso to CD.
+
+=item * 
+
+Insert the CD into your machine and power it up.
+
+=item * 
+
+Hit C<Enter> at the C<boot:> prompt.
+
+=item * 
+
+CD media test: you can either select C<OK> or C<Skip> depending on
+whether or not you trust your burn.
+
+=item * 
+
+The installation GUI should start.  Click next at the "Welcome to
+CentOS-4" screen.
+
+=item * 
+
+Select a language and click C<Next>.
+
+=item * 
+
+Select a keyboard configuration and click C<Next>.
+
+=item * 
+
+Select C<Custom> for the installation type and click C<Next>.
+
+=item * 
+
+Leave C<Automatically partition> selected on the C<Disk Partitioning
+Setup> and click C<Next>.
+
+=item * 
+
+Uncheck C<Review (and modify if needed) the partitions created>, but
+leave the rest of the default settings on the C<Automatic Partitioning>
+screen.  Then click C<Next>.
+
+=item * 
+
+Click C<Yes> at the C<Are you sure you want to do this?> warning.
+
+=item * 
+
+Click C<Next> on the C<Boot Loader Configuration> screen.
+
+=item * 
+
+Update the C<Network Configuration> screen as necessary and click C<Next>.
+
+=item * 
+
+Check C<Remote Login (SSH)> and click C<Next> on the C<Firewall
+Configuration> screen.
+
+=item * 
+
+Select additional languages as necessary.  Click C<Next>.
+
+=item * 
+
+Select the appropriate time zone and click C<Next>.
+
+=item * 
+
+Enter a root password and click C<Next>.
+
+=item * 
+
+Scroll to the bottom of the C<Package Group Selection> screen and check
+C<Minimal> (the last option).  Click C<Next>.
+
+=item * 
+
+Click C<Next> at the C<About to Install> screen.
+
+=item * 
+
+The installation will prepare the hard drive and then install the
+required rpm packages.
+
+=item * 
+
+Once the installation completes, remove the CD and click C<Reboot>.
+
+=item * 
+
+Type C<vi /etc/sysconfig/iptables> and add the following line as the
+third to last line of the file (I<above> the C<-A RH-Firewall-1-INPUT -j
+REJECT --reject-with icmp-host-prohibited> line):
+
+    -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
+
+This will allow Catalyst to make use of port 3000 (the default for the
+development server).
+
+Type C<service iptables restart> to restart the iptables firewall using
+the updated configuration.
+
+=item * 
+
+Type C<yum -y update> to retrieve the latest patches.
+
+=back
+
+
+=head1 INSTALL CATALYST
+
+=over 4
+
+=item * 
+
+Type C<yum -y install gcc expat-devel sqlite3> to install several
+packages used by Catalyst.
+
+=item * 
+
+Type the following:
+
+    $ perl -MCPAN -e shell
+    
+    ...
+    
+    Are you ready for manual configuration? [yes] yes
+    The following questions are intended to help you with the
+    
+    ...
+    
+    cpan shell -- CPAN exploration and modules installation (v1.7601)
+    ReadLine support available (try 'install Bundle::CPAN')
+        
+    cpan> force install Module::Build
+    
+    ...
+    
+    cpan> quit
+
+=item *
+
+B<Note:> You need to have CPAN manually configured prior to running
+cat-install.  As shown above, you should automatically receive
+a prompt for this when you first run C<perl -MCPAN -e shell>.  You
+can re-run the configuration script by typing C<o conf init> at the
+C<cpanE<gt>> prompt.
+
+B<Optional:> The remaining steps of the installation could run 
+significantly faster if you configure a fast mirror that uses HTTP vs. 
+FTP (both transfer data at the same rate once the transfer is in 
+progress, but HTTP connects much more quickly... and a Catalyst 
+installation involves many connections).  If you want to change the 
+selection(s) you made during the "manual configuration" process above, 
+you can manually add a single URL.  To prepend a new URL to the B<front> 
+of the list, use the C<unshift> option to C<o conf>:
+
+    cpan> o conf urllist unshift http://www.perl.com/CPAN/
+
+Where C<http://www.perl.com/CPAN/> is replaced by a nearby, HTTP-based 
+mirror.  You can get a list of all mirrors (including where they are 
+located, their bandwidth, and their update frequency) at 
+L<http://www.perl.com/CPAN/MIRRORED.BY>.
+
+Then, be sure to save your changes (or they will be lost the next
+time you restart the CPAN shell):
+
+    cpan> o conf commit
+
+You can view the current settings with C<o conf urllist> (or just
+C<o conf> to view all settings):
+
+    cpan> o conf urllist
+        urllist           
+            http://www.perl.com/CPAN/
+    Type 'o conf' to view configuration edit options
+Note that multiple values can be entered for the C<urllist> option (the
+first entry will be used as long as it responds).
+
+=item * 
+
+Review the C<cat-install> documentation from the 
+L<http://www.shadowcatsystems.co.uk> web site:
+    
+    If you want to get started quickly with Catalyst, Shadowcat provides an 
+    installer script that will automate most of the process of installing it 
+    for you. Please bear in mind that this script is currently considered 
+    beta quality; we don't think it will eat your system but we make no 
+    guarantee of that.
+    
+    First, you'll need -
+    
+        * Perl, 5.8.1+ (if you're on windows, get it from Active State)
+        * make of some sort. On unix/linux you should already have one. On 
+            windows get nmake from Microsoft.
+        * A compiler. On unix/linux you should already have one. On windows, 
+            get the latest Dev-C++ beta.
+        * All three of the above in your PATH for whatever shell you're using
+        * A configured CPAN.pm. perl -MCPAN -e shell should get CPAN to walk 
+            you through the configuration process
+        * Module::Build. Active State kindly include this for you.
+    
+    Ok, now that your environment is set up, download the installer from 
+    this link, open a command prompt in the directory you downloaded it to 
+    and run perl cat-install. By the time it exits, you should have a full 
+    Catalyst install.
+    
+    If anything goes wrong, please send the full build log and the output of 
+    perl -V to cat-install (at) shadowcatsystems.co.uk so we can try and 
+    resolve your issue.
+
+
+=item * 
+
+Type C<wget http://www.shadowcatsystems.co.uk/static/cat-install> to
+retrieve a copy of the C<cat-install> script.
+
+=item * 
+
+Type C<vi cat-install> to open the installer script, then insert the
+following lines at the bottom of the file (after the
+C<install('Catalyst');> line):
+
+    install('ExtUtils::ParseXS');
+    install('Digest::SHA1');
+    install('Digest::SHA');
+    install('Class::DBI');
+    install('DBIx::Class');
+    install('DBIx::Class::HTMLWidget');
+    install('Module::ScanDeps');
+    install('Module::CoreList');
+    install('PAR::Dist');
+    install('Archive::Tar');
+    install('Module::Install');
+    install('Catalyst::Devel');
+    install('Catalyst::Plugin::ConfigLoader');
+    install('Catalyst::Plugin::Session');
+    install('Catalyst::Plugin::Session::State::Cookie');
+    install('Catalyst::Plugin::Session::Store::FastMmap');
+    install('Catalyst::Plugin::Authorization::ACL');
+    install('Catalyst::Plugin::Authentication');
+    install('Catalyst::Plugin::Authorization::Roles');
+    install('Catalyst::Plugin::Authentication::Store::DBIC');
+    install('Catalyst::Plugin::DefaultEnd');
+    install('Catalyst::Plugin::StackTrace');
+    install('Catalyst::Plugin::Dumper');
+    install('Catalyst::Plugin::HTML::Widget');
+    install('Catalyst::Model::DBIC::Schema');
+    install('Catalyst::View::TT');
+    install('Test::WWW::Mechanize');
+    install('Test::WWW::Mechanize::Catalyst');
+    install('Test::Pod');
+    install('Test::Pod::Coverage');
+
+=item * 
+
+Type C<perl cat-install>.  It will take a while to complete.
+
+Tip: You may want to enable logging of the output that C<cat-install>
+generates as it runs -- it can be useful if you need to troubleshoot
+a failure.  The log will generate almost 1 MB of output.
+
+Note: Once the C<perl cat-install> is complete, you may want to rerun the 
+command to check the status of the packages listed in <cat-install>. Ideally, 
+everything should return a I<name> C<is up to date> message.  If any packages 
+try to re-install, the you could need to manually install the package with the 
+C<force> option.  Also, look for new optional dependences that C<cat-install> 
+was not able to automatically handle. You can address these by manually 
+installing the dependency and then re-running C<perl cat-install>.  
+
+In some cases you may wish to install an earlier version of a module.  For
+example, say that the latest version of Module::Install is 0.64 and you
+want to install 0.63.  The following command under C<perl -MCPAN -e shell>:
+
+    cpan> install A/AD/ADAMK/Module-Install-0.63.tar.gz
+
+=back
+
+You should now have a functioning Catalyst installation with the modules
+and plugins required to run the Catalyst tutorial.
+
+
+=head1 TESTING THE INSTALLATION
+
+=over 4
+
+=item *
+
+Download the tarball of the final tutorial application:
+
+    $ wget http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/Final_Tarball/MyApp.tgz
+
+=item *
+
+Untar it:
+
+    $ tar zxvf MyApp.tgz
+    $ cd MyApp
+
+=item *
+
+Run the tests:
+
+    $ CATALYST_DEBUG=0 prove --lib lib  t
+    t/02pod...............skipped
+            all skipped: set TEST_POD to enable this test
+    t/03podcoverage.......skipped
+            all skipped: set TEST_POD to enable this test
+    t/01app...............ok                                                     
+    t/controller_Login....ok                                                     
+    t/live_app01..........ok 1/0[debug] ***Root::auto User not found, forwarding to /login
+    t/live_app01..........ok 2/0[debug] ***Root::auto User not found, forwarding to /login
+    t/live_app01..........ok 15/0[debug] ***Root::auto User not found, forwarding to /login
+    t/live_app01..........ok 16/0[debug] ***Root::auto User not found, forwarding to /login
+    t/live_app01..........ok                                                     
+    t/model_MyAppDB.......ok                                                     
+    All tests successful, 2 tests skipped.
+    Files=6, Tests=55, 11 wallclock secs ( 4.68 cusr +  4.84 csys =  9.52 CPU)
+
+You should see C<All tests successful>.
+
+=back
+
+
+
+=head1 AUTHOR
+
+Kennedy Clark, C<hkclark@gmail.com>
+
+Please report any errors, issues or suggestions to the author.  The
+most recent version of the Catalyst Tutorial can be found at
+L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
+
+Copyright 2006, Kennedy Clark, under Creative Commons License
+(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
diff --git a/lib/Catalyst/Manual/Internals.pod b/lib/Catalyst/Manual/Internals.pod
new file mode 100644 (file)
index 0000000..41efa22
--- /dev/null
@@ -0,0 +1,90 @@
+=head1 NAME
+
+Catalyst::Manual::Internals - Catalyst Internals
+
+=head1 DESCRIPTION
+
+This document provides an overview of the internals of
+Catalyst.  As Catalyst is still developing rapidly, details
+may become out of date: please treat this as a guide, and
+look at the source for the last word.
+
+The coverage is split into initialization and request lifecycle.
+
+=head2 Initialization
+
+Catalyst initializes itself in two stages (I may be wrong in some of
+the details here - AF):
+
+=over 4
+
+=item 1
+
+When the Catalyst module is imported in the main application
+module it evaluates any options (C<-Debug>, C<-Engine=XXX>)
+and loads any specified plugins, making the application module
+inherit from the plugin classes. It also sets up a default log
+object and ensures that the application module inherits from
+C<Catalyst> and from the selected specialized Engine module.
+
+=item 2
+
+When the application module makes the first call to C<< __PACKAGE__->action() >>
+(implemented in C<Catalyst::Engine>), Catalyst automatically loads all
+components it finds in the C<$class::Controller>, C<$class::C>,
+C<$class::Model>, C<$class::M>, C<$class::View> and C<$class::V>
+namespaces (using C<Module::Pluggable::Fast>).  A table of actions is built up
+and added to on subsequent calls to C<action()>.
+
+=back
+
+
+=head2 Request Lifecycle
+
+For each request Catalyst builds a I<context> object, which includes
+information about the request, and then searches the action table for matching
+actions.  
+
+The handling of a request can be divided into three stages: preparation of the
+context, processing of the request, and finalization of the response.  These
+are the steps of a Catalyst request in detail; every step can be overloaded to
+extend Catalyst.
+
+    handle_request
+      prepare
+        prepare_request
+        prepare_connection
+        prepare_query_parameters
+        prepare_headers
+        prepare_cookies
+        prepare_path
+        prepare_body (unless parse_on_demand)
+          prepare_body_parameters
+          prepare_parameters
+          prepare_uploads
+        prepare_action
+      dispatch
+      finalize
+        finalize_uploads
+        finalize_error (if one happened)
+        finalize_headers
+          finalize_cookies
+        finalize_body
+
+These steps are normally overloaded from engine classes, and may also be
+extended by plugins.  Extending means using multiple inheritance with L<NEXT>.
+
+The specialized engine classes populate the Catalyst request object with
+information from the underlying layer (C<Apache::Request> or C<CGI::Simple>)
+during the prepare phase, then push the generated response information down to
+the underlying layer during the finalize phase.
+
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it under
+the same terms as Perl itself.
diff --git a/lib/Catalyst/Manual/Intro.pod b/lib/Catalyst/Manual/Intro.pod
new file mode 100644 (file)
index 0000000..5aff621
--- /dev/null
@@ -0,0 +1,1177 @@
+=head1 NAME
+
+Catalyst::Manual::Intro - Introduction to Catalyst
+
+=head1 DESCRIPTION
+
+This is a brief introduction to Catalyst. It explains the most important
+features of how Catalyst works and shows how to get a simple application
+up and running quickly. For an introduction (without code) to Catalyst
+itself, and why you should be using it, see L<Catalyst::Manual::About>.
+For a systematic step-by-step introduction to writing an application
+with Catalyst, see L<Catalyst::Manual::Tutorial>.
+
+=head2 What is Catalyst?
+
+Catalyst is an elegant web application framework, extremely flexible
+yet extremely simple. It's similar to Ruby on Rails, Spring (Java),
+and L<Maypole>, upon which it was originally based. Its most important
+design philosphy is to provide easy access to all the tools you need
+to develop web applications, with few restrictions on how you need to
+use these tools. However, this does mean that it is always possible to
+do things in a different way. Other web frameworks are B<initially>
+simpler to use, but achieve this by locking the programmer into a
+single set of tools. Catalyst's emphasis on flexibility means that you
+have to think more to use it. We view this as a feature.  For example,
+this leads to Catalyst being more suited to system integration tasks
+than other web frameworks.
+
+=head3 MVC
+
+Catalyst follows the Model-View-Controller (MVC) design pattern,
+allowing you to easily separate concerns, like content, presentation,
+and flow control, into separate modules. This separation allows you to
+modify code that handles one concern without affecting code that handles
+the others. Catalyst promotes the re-use of existing Perl modules that
+already handle common web application concerns well.
+
+Here's how the Model, View, and Controller map to those concerns, with
+examples of well-known Perl modules you may want to use for each.
+
+=over 4
+
+=item * B<Model>
+
+Access and modify content (data). L<DBIx::Class>, L<Class::DBI>,
+L<Xapian>, L<Net::LDAP>...
+
+=item * B<View>
+
+Present content to the user. L<Template Toolkit|Template>,
+L<Mason|HTML::Mason>, L<HTML::Template>...
+
+=item * B<Controller>
+
+Control the whole request phase, check parameters, dispatch actions, flow
+control. Catalyst itself!
+
+=back
+
+If you're unfamiliar with MVC and design patterns, you may want to
+check out the original book on the subject, I<Design Patterns>, by
+Gamma, Helm, Johnson, and Vlissides, also known as the Gang of Four
+(GoF).  Many, many web application frameworks are based on MVC, which
+is becoming a popular design paradigm for the world wide web.
+
+=head3 Flexibility
+
+Catalyst is much more flexible than many other frameworks. Rest assured
+you can use your favorite Perl modules with Catalyst.
+
+=over 4
+
+=item * B<Multiple Models, Views, and Controllers>
+
+To build a Catalyst application, you handle each type of concern inside
+special modules called L</Components>. Often this code will be very
+simple, just calling out to Perl modules like those listed above under
+L</MVC>. Catalyst handles these components in a very flexible way. Use
+as many Models, Views, and Controllers as you like, using as many
+different Perl modules as you like, all in the same application. Want to
+manipulate multiple databases, and retrieve some data via LDAP? No
+problem. Want to present data from the same Model using L<Template
+Toolkit|Template> and L<PDF::Template>? Easy.
+
+=item * B<Reuseable Components>
+
+Not only does Catalyst promote the re-use of already existing Perl
+modules, it also allows you to re-use your Catalyst components in
+multiple Catalyst applications.
+
+=item * B<Unrestrained URL-to-Action Dispatching>
+
+Catalyst allows you to dispatch any URLs to any application L</Actions>,
+even through regular expressions! Unlike most other frameworks, it
+doesn't require mod_rewrite or class and method names in URLs.
+
+With Catalyst you register your actions and address them directly. For
+example:
+
+    sub hello : Global {
+        my ( $self, $context ) = @_;
+        $context->response->body('Hello World!');
+    }
+
+Now http://localhost:3000/hello prints "Hello World!".
+
+=item * B<Support for CGI, mod_perl, Apache::Request, FastCGI>
+
+Use L<Catalyst::Engine::Apache> or L<Catalyst::Engine::CGI>. Other
+engines are also available.
+
+=back
+
+=head3 Simplicity
+
+The best part is that Catalyst implements all this flexibility in a very
+simple way.
+
+=over 4
+
+=item * B<Building Block Interface>
+
+Components interoperate very smoothly. For example, Catalyst
+automatically makes a L</Context> object available to every
+component. Via the context, you can access the request object, share
+data between components, and control the flow of your
+application. Building a Catalyst application feels a lot like snapping
+together toy building blocks, and everything just works.
+
+=item * B<Component Auto-Discovery>
+
+No need to C<use> all of your components. Catalyst automatically finds
+and loads them.
+
+=item * B<Pre-Built Components for Popular Modules>
+
+See L<Catalyst::Model::DBIC::Schema> for L<DBIx::Class>, or
+L<Catalyst::View::TT> for L<Template Toolkit|Template>.
+
+=item * B<Built-in Test Framework>
+
+Catalyst comes with a built-in, lightweight http server and test
+framework, making it easy to test applications from the web browser,
+and the command line.
+
+=item * B<Helper Scripts>
+
+Catalyst provides helper scripts to quickly generate running starter
+code for components and unit tests. Install L<Catalyst::Devel> and see
+L<Catalyst::Helper>.
+
+=back
+
+=head2 Quickstart
+
+Here's how to install Catalyst and get a simple application up and
+running, using the helper scripts described above.
+
+=head3 Install
+
+Installation of Catalyst can be a time-consuming and frustrating
+effort, due to its large number of dependencies. The easiest way
+to get up and running is to use Matt Trout's C<cat-install>
+script, from L<http://www.shadowcatsystems.co.uk/static/cat-install>,
+and then install L<Catalyst::Devel>.
+
+    # perl cat-install
+    # perl -MCPAN -e 'install Catalyst::Devel'
+
+=head3 Setup
+
+    $ catalyst.pl MyApp
+    # output omitted
+    $ cd MyApp
+    $ script/myapp_create.pl controller Library::Login
+
+=head3 Run
+
+    $ script/myapp_server.pl
+
+Now visit these locations with your favorite browser or user agent to see
+Catalyst in action:
+
+(NOTE: Although we create a controller here, we don't actually use it.
+Both of these URLs should take you to the welcome page.)
+
+
+=over 4
+
+=item http://localhost:3000/
+
+=item http://localhost:3000/library/login/
+
+=back
+
+=head2 How It Works
+
+Let's see how Catalyst works, by taking a closer look at the components
+and other parts of a Catalyst application.
+
+=head3 Components
+
+Catalyst has an uncommonly flexible component system. You can define as
+many L</Models>, L</Views>, and L</Controllers> as you like. As discussed
+previously, the general idea is that the View is responsible for the
+output of data to the user (typically via a web browser, but a View can
+also generate PDFs or e-mails, for example); the Model is responsible 
+for providing data (typically from a relational database); and the
+Controller is responsible for interacting with the user and deciding
+how user input determines what actions the application takes.
+
+In the world of MVC, there are frequent discussions and disagreements
+about the nature of each element - whether certain types of logic
+belong in the Model or the Controller, etc. Catalyst's flexibility
+means that this decision is entirely up to you, the programmer; 
+Catalyst doesn't enforce anything. See L<Catalyst::Manual::About> for
+a general discussion of these issues.
+
+All components must inherit from L<Catalyst::Base>, which provides a
+simple class structure and some common class methods like C<config> and
+C<new> (constructor).
+
+    package MyApp::Controller::Catalog;
+
+    use strict;
+    use base 'Catalyst::Base';
+
+    __PACKAGE__->config( foo => 'bar' );
+
+    1;
+
+You don't have to C<use> or otherwise register Models, Views, and
+Controllers.  Catalyst automatically discovers and instantiates them
+when you call C<setup> in the main application. All you need to do is
+put them in directories named for each Component type. You can use a
+short alias for each one.
+
+=over 4
+
+=item * B<MyApp/Model/> 
+
+=item * B<MyApp/M/>
+
+=item * B<MyApp/View/>
+
+=item * B<MyApp/V/>
+
+=item * B<MyApp/Controller/>
+
+=item * B<MyApp/C/>
+
+=back
+
+In older versions of Catalyst, the recommended practice (and the one
+automatically created by helper scripts) was to name the directories
+C<M/>, C<V/>, and C<C/>. Though these still work, we now recommend
+the use of the full names.
+
+=head4 Views
+
+To show how to define views, we'll use an already-existing base class for the
+L<Template Toolkit|Template>, L<Catalyst::View::TT>. All we need to do is
+inherit from this class:
+
+    package MyApp::View::TT;
+
+    use strict;
+    use base 'Catalyst::View::TT';
+
+    1;
+
+(You can also generate this automatically by using the helper script:
+
+    script/myapp_create.pl view TT TT
+
+where the first C<TT> tells the script that the name of the view should
+be C<TT>, and the second that it should be a Template Toolkit view.)
+
+This gives us a process() method and we can now just do
+$c->forward('MyApp::View::TT') to render our templates. The base class
+makes process() implicit, so we don't have to say
+C<$c-E<gt>forward(qw/MyApp::View::TT process/)>.
+
+    sub hello : Global {
+        my ( $self, $c ) = @_;
+        $c->stash->{template} = 'hello.tt';
+    }
+
+    sub end : Private {
+        my ( $self, $c ) = @_;
+        $c->forward( $c->view('TT') );
+    }
+
+You normally render templates at the end of a request, so it's a perfect
+use for the global C<end> action.
+
+In practice, however, you would use a default C<end> action as supplied
+by L<Catalyst::Action::RenderView>.
+
+Also, be sure to put the template under the directory specified in
+C<$c-E<gt>config-E<gt>{root}>, or you'll end up looking at the debug
+screen.
+
+=head4 Models
+
+Models are providers of data. This data could come from anywhere - a
+search engine index, a spreadsheet, the file system - but typically a
+Model represents a database table. The data source does not
+intrinsically have much to do with web applications or Catalyst - it
+could just as easily be used to write an offline report generator or a
+command-line tool.
+
+To show how to define models, again we'll use an already-existing base
+class, this time for L<DBIx::Class>: L<Catalyst::Model::DBIC::Schema>.
+We'll also need L<DBIx::Class::Schema::Loader>.
+
+But first, we need a database.
+
+    -- myapp.sql
+    CREATE TABLE foo (
+        id INTEGER PRIMARY KEY,
+        data TEXT
+    );
+
+    CREATE TABLE bar (
+        id INTEGER PRIMARY KEY,
+        foo INTEGER REFERENCES foo,
+        data TEXT
+    );
+
+    INSERT INTO foo (data) VALUES ('TEST!');
+
+    % sqlite /tmp/myapp.db < myapp.sql
+
+Now we can create a DBIC::Schema model for this database.
+
+    script/myapp_create.pl model MyModel DBIC::Schema MySchema create=static 'dbi:SQLite:/tmp/myapp.db'
+
+L<DBIx::Class::Schema::Loader> automatically loads table layouts and
+relationships, and converts them into a static schema definition C<MySchema>,
+which you can edit later.
+
+Use the stash to pass data to your templates.
+
+We add the following to MyApp/Controller/Root.pm
+
+    sub view : Global {
+        my ( $self, $c, $id ) = @_;
+        
+        $c->stash->{item} = $c->model('MyModel::Foo')->find($id);
+    }
+
+    1;
+    
+    sub end : Private {
+        my ( $self, $c ) = @_;
+        
+        $c->stash->{template} ||= 'index.tt';
+        $c->forward( $c->view('TT') );
+    }
+
+We then create a new template file "root/index.tt" containing:
+
+    The Id's data is [% item.data %]
+
+Models do not have to be part of your Catalyst application; you
+can always call an outside module that serves as your Model:
+
+    # in a Controller
+    sub list : Local {
+      my ( $self, $c ) = @_;
+      
+      $c->stash->{template} = 'list.tt';
+      
+      use Some::Outside::Database::Module;
+      my @records = Some::Outside::Database::Module->search({
+        artist => 'Led Zeppelin',
+        });
+      
+      $c->stash->{records} = \@records;
+    }
+
+But by using a Model that is part of your Catalyst application, you
+gain several things: you don't have to C<use> each component, Catalyst
+will find and load it automatically at compile-time; you can
+C<forward> to the module, which can only be done to Catalyst
+components.  Only Catalyst components can be fetched with
+C<$c-E<gt>model('SomeModel')>.
+
+Happily, since many people have existing Model classes that they
+would like to use with Catalyst (or, conversely, they want to
+write Catalyst models that can be used outside of Catalyst, e.g.
+in a cron job), it's trivial to write a simple component in
+Catalyst that slurps in an outside Model:
+
+    package MyApp::Model::DB;
+    use base qw/Catalyst::Model::DBIC::Schema/;
+    __PACKAGE__->config(
+        schema_class => 'Some::DBIC::Schema',
+        connect_info => ['dbi:SQLite:foo.db', '', '', {AutoCommit=>1}]
+    );
+    1;
+
+and that's it! Now C<Some::DBIC::Schema> is part of your
+Cat app as C<MyApp::Model::DB>.
+
+Within Catalyst, the common approach to writing a model for your
+application is wrapping a generic model (e.g. L<DBIx::Class::Schema>, a
+bunch of XMLs, or anything really) with an object that contains
+configuration data, convenience methods, and so forth. Thus you
+will in effect have two models - a wrapper model that knows something
+about Catalyst and your web application, and a generic model that is
+totally independent of these needs.
+
+Technically, within Catalyst a model is a B<component> - an instance of
+the model's class belonging to the application. It is important to
+stress that the lifetime of these objects is per application, not per
+request.
+
+While the model base class (L<Catalyst::Model>) provides things like
+C<config> to better integrate the model into the application, sometimes
+this is not enough, and the model requires access to C<$c> itself.
+
+Situations where this need might arise include:
+
+=over 4
+
+=item *
+
+Interacting with another model
+
+=item *
+
+Using per-request data to control behavior
+
+=item *
+
+Using plugins from a Model (for example L<Catalyst::Plugin::Cache>).
+
+=back
+
+From a style perspective it's usually considered bad form to make your
+model "too smart" about things - it should worry about business logic
+and leave the integration details to the controllers. If, however, you
+find that it does not make sense at all to use an auxillary controller
+around the model, and the model's need to access C<$c> cannot be
+sidestepped, there exists a power tool called L</ACCEPT_CONTEXT>.
+
+=head4 Controllers
+
+Multiple controllers are a good way to separate logical domains of your
+application.
+
+    package MyApp::Controller::Login;
+
+    use base qw/Catalyst::Controller/;
+
+    sub login : Path("login") { }
+    sub new_password : Path("new-password") { }
+    sub logout : Path("logout") { }
+
+    package MyApp::Controller::Catalog;
+
+    use base qw/Catalyst::Controller/;
+
+    sub view : Local { }
+    sub list : Local { }
+
+    package MyApp::Controller::Cart;
+
+    use base qw/Catalyst::Controller/;
+
+    sub add : Local { }
+    sub update : Local { }
+    sub order : Local { }
+
+Note that you can also supply attributes via the Controller's config so
+long as you have at least one attribute on a subref to be exported
+(:Action is commonly used for this) - for example the following is
+equivalent to the same controller above:
+
+    package MyApp::Controller::Login;
+
+    use base qw/Catalyst::Controller/;
+
+    __PACKAGE__->config(
+      actions => {
+        'sign_in' => { Path => 'sign-in' },
+        'new_password' => { Path => 'new-password' },
+        'sign_out' => { Path => 'sign-out' },
+      },
+    );
+
+    sub sign_in : Action { }
+    sub new_password : Action { }
+    sub sign_out : Action { }
+
+=head3 ACCEPT_CONTEXT
+
+Whenever you call $c->component("Foo") you get back an object - the
+instance of the model. If the component supports the C<ACCEPT_CONTEXT>
+method instead of returning the model itself, the return value of C<<
+$model->ACCEPT_CONTEXT( $c ) >> will be used.
+
+This means that whenever your model/view/controller needs to talk to C<$c> it
+gets a chance to do this when it's needed.
+
+A typical C<ACCEPT_CONTEXT> method will either clone the model and return one
+with the context object set, or it will return a thin wrapper that contains
+C<$c> and delegates to the per-application model object.
+
+A typical C<ACCEPT_CONTEXT> method could look like this:
+
+    sub ACCEPT_CONTEXT {
+      my ( $self, $c, @extra_arguments ) = @_;
+      bless { %$self, c => $c }, ref($self);
+    }
+
+effectively treating $self as a B<prototype object> that gets a new parameter.
+C<@extra_arguments> comes from any trailing arguments to
+C<< $c->component( $bah, @extra_arguments ) >> (or C<< $c->model(...) >>,
+C<< $c->view(...) >> etc).
+
+The life time of this value is B<per usage>, and not per request. To make this
+per request you can use the following technique:
+
+Add a field to C<$c>, like C<my_model_instance>. Then write your
+C<ACCEPT_CONTEXT> method to look like this:
+
+    sub ACCEPT_CONTEXT {
+      my ( $self, $c ) = @_;
+
+      if ( my $per_request = $c->my_model_instance ) {
+        return $per_request;
+      } else {
+        my $new_instance = bless { %$self, c => $c }, ref($self);
+        Scalar::Util::weaken($new_instance->{c}); # or we have a circular reference
+        $c->my_model_instance( $new_instance );
+        return $new_instance;
+      }
+    }
+
+=head3 Application Class
+
+In addition to the Model, View, and Controller components, there's a
+single class that represents your application itself. This is where you
+configure your application, load plugins, and extend Catalyst.
+
+    package MyApp;
+
+    use strict;
+    use Catalyst qw/-Debug/; # Add other plugins here, e.g.
+                             # for session support
+
+    MyApp->config(
+        name => 'My Application',
+
+        # You can put anything else you want in here:
+        my_configuration_variable => 'something',
+    );
+    1;
+
+In older versions of Catalyst, the application class was where you put
+global actions. However, as of version 5.66, the recommended practice is
+to place such actions in a special Root controller (see L</Actions>,
+below), to avoid namespace collisions.
+
+=over 4
+
+=item * B<name>
+
+The name of your application.
+
+=back
+
+Optionally, you can specify a B<root> parameter for templates and static
+data.  If omitted, Catalyst will try to auto-detect the directory's
+location. You can define as many parameters as you want for plugins or
+whatever you need. You can access them anywhere in your application via
+C<$context-E<gt>config-E<gt>{$param_name}>.
+
+=head3 Context
+
+Catalyst automatically blesses a Context object into your application
+class and makes it available everywhere in your application. Use the
+Context to directly interact with Catalyst and glue your L</Components>
+together. For example, if you need to use the Context from within a
+Template Toolkit template, it's already there:
+
+    <h1>Welcome to [% c.config.name %]!</h1>
+
+As illustrated in our URL-to-Action dispatching example, the Context is
+always the second method parameter, behind the Component object
+reference or class name itself. Previously we called it C<$context> for
+clarity, but most Catalyst developers just call it C<$c>:
+
+    sub hello : Global {
+        my ( $self, $c ) = @_;
+        $c->res->body('Hello World!');
+    }
+
+The Context contains several important objects:
+
+=over 4
+
+=item * L<Catalyst::Request>
+
+    $c->request
+    $c->req # alias
+
+The request object contains all kinds of request-specific information, like
+query parameters, cookies, uploads, headers, and more.
+
+    $c->req->params->{foo};
+    $c->req->cookies->{sessionid};
+    $c->req->headers->content_type;
+    $c->req->base;
+    $c->req->uri_with( { page = $pager->next_page } );
+
+=item * L<Catalyst::Response>
+
+    $c->response
+    $c->res # alias
+
+The response is like the request, but contains just response-specific
+information.
+
+    $c->res->body('Hello World');
+    $c->res->status(404);
+    $c->res->redirect('http://oook.de');
+
+=item * L<Catalyst::Config>
+
+    $c->config
+    $c->config->{root};
+    $c->config->{name};
+
+=item * L<Catalyst::Log>
+
+    $c->log
+    $c->log->debug('Something happened');
+    $c->log->info('Something you should know');
+
+=item * B<Stash>
+
+    $c->stash
+    $c->stash->{foo} = 'bar';
+    $c->stash->{baz} = {baz => 'qox'};
+    $c->stash->{fred} = [qw/wilma pebbles/];
+
+and so on.
+
+=back
+
+The last of these, the stash, is a universal hash for sharing data among
+application components. For an example, we return to our 'hello' action:
+
+    sub hello : Global {
+        my ( $self, $c ) = @_;
+        $c->stash->{message} = 'Hello World!';
+        $c->forward('show_message');
+    }
+
+    sub show_message : Private {
+        my ( $self, $c ) = @_;
+        $c->res->body( $c->stash->{message} );
+    }
+
+Note that the stash should be used only for passing data in an
+individual request cycle; it gets cleared at a new request. If you need
+to maintain persistent data, use a session. See
+L<Catalyst::Plugin::Session> for a comprehensive set of
+Catalyst-friendly session-handling tools.
+
+=head3 Actions
+
+A Catalyst controller is defined by its actions. An action is a
+subroutine with a special attribute. You've already seen some examples
+of actions in this document. The URL (for example
+http://localhost.3000/foo/bar) consists of two parts, the base
+(http://localhost:3000/ in this example) and the path (foo/bar).  Please
+note that the trailing slash after the hostname[:port] always belongs to
+base and not to the action.
+
+=over 4
+
+=item * B<Application Wide Actions>
+
+Actions which are called at the root level of the application
+(e.g. http://localhost:3000/ ) go in MyApp::Controller::Root, like
+this:
+
+    package MyApp::Controller::Root;
+    use base 'Catalyst::Controller';
+    # Sets the actions in this controller to be registered with no prefix
+    # so they function identically to actions created in MyApp.pm
+    __PACKAGE__->config->{namespace} = '';
+    sub default : Private {
+        my ( $self, $context ) = @_;
+        $context->response->body('Catalyst rocks!');
+    }
+    1;
+
+=back
+
+=head4 Action types
+
+Catalyst supports several types of actions:
+
+=over 4
+
+=item * B<Literal> (B<Path> actions)
+
+    package MyApp::Controller::My::Controller;
+    sub bar : Path('foo/bar') { }
+
+Literal C<Path> actions will act relative to their current
+namespace. The above example matches only
+http://localhost:3000/my/controller/foo/bar. If you start your path with
+a forward slash, it will match from the root. Example:
+
+    package MyApp::Controller::My::Controller;
+    sub bar : Path('/foo/bar') { }
+
+Matches only http://localhost:3000/foo/bar.
+
+    package MyApp::Controller::My::Controller;
+    sub bar : Path { }
+
+By leaving the C<Path> definition empty, it will match on the namespace
+root. The above code matches http://localhost:3000/my/controller.
+
+=item * B<Regex>
+
+    sub bar : Regex('^item(\d+)/order(\d+)$') { }
+
+Matches any URL that matches the pattern in the action key, e.g.
+http://localhost:3000/item23/order42. The '' around the regexp is
+optional, but perltidy likes it. :)
+
+Regex matches act globally, i.e. without reference to the namespace from
+which it is called, so that a C<bar> method in the
+C<MyApp::Controller::Catalog::Order::Process> namespace won't match any
+form of C<bar>, C<Catalog>, C<Order>, or C<Process> unless you
+explicitly put this in the regex. To achieve the above, you should
+consider using a C<LocalRegex> action.
+
+=item * B<LocalRegex>
+
+    sub bar : LocalRegex('^widget(\d+)$') { }
+
+LocalRegex actions act locally. If you were to use C<bar> in
+C<MyApp::Controller::Catalog>, the above example would match urls like
+http://localhost:3000/catalog/widget23.
+
+If you omit the "C<^>" from your regex, then it will match any depth
+from the controller and not immediately off of the controller name. The
+following example differs from the above code in that it will match
+http://localhost:3000/catalog/foo/widget23 as well.
+
+    package MyApp::Controller::Catalog;
+    sub bar : LocalRegex('widget(\d+)$') { }
+
+For both LocalRegex and Regex actions, if you use capturing parentheses
+to extract values within the matching URL, those values are available in
+the C<$c-E<gt>req-E<gt>captures> array. In the above example, "widget23"
+would capture "23" in the above example, and
+C<$c-E<gt>req-E<gt>captures-E<gt>[0]> would be "23". If you want to pass
+arguments at the end of your URL, you must use regex action keys. See
+L</URL Path Handling> below.
+
+=item * B<Top-level> (B<Global>)
+
+    package MyApp::Controller::Foo;
+    sub foo : Global { }
+
+Matches http://localhost:3000/foo. The function name is mapped
+directly to the application base.  You can provide an equivalent
+function in this case  by doing the following:
+
+    package MyApp::Controller::Root
+    sub foo : Local { }
+
+=item * B<Namespace-Prefixed> (B<Local>)
+
+    package MyApp::Controller::My::Controller; 
+    sub foo : Local { }
+
+Matches http://localhost:3000/my/controller/foo. 
+
+This action type indicates that the matching URL must be prefixed with a
+modified form of the component's class (package) name. This modified
+class name excludes the parts that have a pre-defined meaning in
+Catalyst ("MyApp::Controller" in the above example), replaces "::" with
+"/", and converts the name to lower case.  See L</Components> for a full
+explanation of the pre-defined meaning of Catalyst component class
+names.
+
+=item * B<Chained>
+
+Catalyst also provides a method to build and dispatch chains of actions,
+like
+
+    sub catalog : Chained : CaptureArgs(1) {
+        my ( $self, $c, $arg ) = @_;
+        ...
+    }
+
+    sub item : Chained('catalog') : Args(1) {
+        my ( $self, $c, $arg ) = @_;
+        ...
+    }
+
+to handle a C</catalog/*/item/*> path. For further information about this
+dispatch type, please see L<Catalyst::DispatchType::Chained>.
+
+=item * B<Private>
+
+    sub foo : Private { }
+
+Matches no URL, and cannot be executed by requesting a URL that
+corresponds to the action key. Private actions can be executed only
+inside a Catalyst application, by calling the C<forward> method:
+
+    $c->forward('foo');
+
+See L</Flow Control> for a full explanation of C<forward>. Note that, as
+discussed there, when forwarding from another component, you must use
+the absolute path to the method, so that a private C<bar> method in your
+C<MyApp::Controller::Catalog::Order::Process> controller must, if called
+from elsewhere, be reached with
+C<$c-E<gt>forward('/catalog/order/process/bar')>.
+
+=item * B<Args>
+
+Args is not an action type per se, but an action modifier - it adds a
+match restriction to any action it's provided to, requiring only as many
+path parts as are specified for the action to be valid - for example in
+MyApp::Controller::Foo,
+
+  sub bar :Local
+
+would match any URL starting /foo/bar/. To restrict this you can do
+
+  sub bar :Local :Args(1)
+
+to only match /foo/bar/*/
+
+=back
+
+B<Note:> After seeing these examples, you probably wonder what the point
+is of defining names for regex and path actions. Every public action is
+also a private one, so you have one unified way of addressing components
+in your C<forward>s.
+
+=head4 Built-in Private Actions
+
+In response to specific application states, Catalyst will automatically
+call these built-in private actions in your application class:
+
+=over 4
+
+=item * B<default : Private>
+
+Called when no other action matches. Could be used, for example, for
+displaying a generic frontpage for the main app, or an error page for
+individual controllers.
+
+If C<default> isn't acting how you would expect, look at using a
+L</Literal> C<Path> action (with an empty path string). The difference
+is that C<Path> takes arguments relative from the namespace and
+C<default> I<always> takes arguments relative from the root, regardless
+of what controller it's in. Indeed, this is now the recommended way of
+handling default situations; the C<default> private controller should
+be considered deprecated.
+
+=item * B<index : Private>
+
+C<index> is much like C<default> except that it takes no arguments
+and it is weighted slightly higher in the matching process. It is
+useful as a static entry point to a controller, e.g. to have a static
+welcome page. Note that it's also weighted higher than Path.
+
+=item * B<begin : Private>
+
+Called at the beginning of a request, before any matching actions are
+called.
+
+=item * B<end : Private>
+
+Called at the end of a request, after all matching actions are called.
+
+=back
+
+=head4 Built-in actions in controllers/autochaining
+
+    Package MyApp::Controller::Foo;
+    sub begin : Private { }
+    sub default : Private { }
+    sub auto : Private { }
+
+You can define built-in private actions within your controllers as
+well. The actions will override the ones in less-specific controllers,
+or your application class. In other words, for each of the three
+built-in private actions, only one will be run in any request
+cycle. Thus, if C<MyApp::Controller::Catalog::begin> exists, it will be
+run in place of C<MyApp::begin> if you're in the C<catalog> namespace,
+and C<MyApp::Controller::Catalog::Order::begin> would override this in
+turn.
+
+=over 4
+
+=item * B<auto : Private>
+
+In addition to the normal built-in actions, you have a special action
+for making chains, C<auto>. Such C<auto> actions will be run after any
+C<begin>, but before your action is processed. Unlike the other
+built-ins, C<auto> actions I<do not> override each other; they will be
+called in turn, starting with the application class and going through to
+the I<most> specific class. I<This is the reverse of the order in which
+the normal built-ins override each other>.
+
+=back
+
+Here are some examples of the order in which the various built-ins
+would be called:
+
+=over 4
+
+=item for a request for C</foo/foo>
+
+  MyApp::begin
+  MyApp::auto
+  MyApp::Controller::Foo::default # in the absence of MyApp::Controller::Foo::Foo
+  MyApp::end
+
+=item for a request for C</foo/bar/foo>
+
+  MyApp::Controller::Foo::Bar::begin
+  MyApp::auto
+  MyApp::Controller::Foo::auto
+  MyApp::Controller::Foo::Bar::auto
+  MyApp::Controller::Foo::Bar::default # for MyApp::Controller::Foo::Bar::foo
+  MyApp::Controller::Foo::Bar::end
+
+=back
+
+The C<auto> action is also distinguished by the fact that you can break
+out of the processing chain by returning 0. If an C<auto> action returns
+0, any remaining actions will be skipped, except for C<end>. So, for the
+request above, if the first auto returns false, the chain would look
+like this:
+
+=over 4
+
+=item for a request for C</foo/bar/foo> where first C<auto> returns
+false
+
+  MyApp::Controller::Foo::Bar::begin
+  MyApp::auto
+  MyApp::Controller::Foo::Bar::end
+
+=back
+
+An example of why one might use this is an authentication action: you
+could set up a C<auto> action to handle authentication in your
+application class (which will always be called first), and if
+authentication fails, returning 0 would skip any remaining methods
+for that URL.
+
+B<Note:> Looking at it another way, C<auto> actions have to return a
+true value to continue processing! You can also C<die> in the auto
+action; in that case, the request will go straight to the finalize
+stage, without processing further actions.
+
+=head4 URL Path Handling
+
+You can pass variable arguments as part of the URL path, separated with 
+forward slashes (/). If the action is a Regex or LocalRegex, the '$' anchor 
+must be used. For example, suppose you want to handle C</foo/$bar/$baz>, 
+where C<$bar> and C<$baz> may vary:
+
+    sub foo : Regex('^foo$') { my ($self, $context, $bar, $baz) = @_; }
+
+But what if you also defined actions for C</foo/boo> and C</foo/boo/hoo>?
+
+    sub boo : Path('foo/boo') { .. }
+    sub hoo : Path('foo/boo/hoo') { .. }
+
+Catalyst matches actions in most specific to least specific order:
+
+    /foo/boo/hoo
+    /foo/boo
+    /foo # might be /foo/bar/baz but won't be /foo/boo/hoo
+
+So Catalyst would never mistakenly dispatch the first two URLs to the
+'^foo$' action.
+
+If a Regex or LocalRegex action doesn't use the '$' anchor, the action will 
+still match a URL containing arguments, however the arguments won't be 
+available via C<@_>.
+
+=head4 Parameter Processing
+
+Parameters passed in the URL query string are handled with methods in
+the L<Catalyst::Request> class. The C<param> method is functionally
+equivalent to the C<param> method of C<CGI.pm> and can be used in
+modules that require this.
+
+    # http://localhost:3000/catalog/view/?category=hardware&page=3
+    my $category = $c->req->param('category');
+    my $current_page = $c->req->param('page') || 1;
+
+    # multiple values for single parameter name
+    my @values = $c->req->param('scrolling_list');         
+
+    # DFV requires a CGI.pm-like input hash
+    my $results = Data::FormValidator->check($c->req->params, \%dfv_profile);
+
+=head3 Flow Control
+
+You control the application flow with the C<forward> method, which
+accepts the key of an action to execute. This can be an action in the
+same or another Catalyst controller, or a Class name, optionally
+followed by a method name. After a C<forward>, the control flow will
+return to the method from which the C<forward> was issued.
+
+A C<forward> is similar to a method call. The main differences are that
+it wraps the call in an C<eval> to allow exception handling; it
+automatically passes along the context object (C<$c> or C<$context>);
+and it allows profiling of each call (displayed in the log with
+debugging enabled).
+
+    sub hello : Global {
+        my ( $self, $c ) = @_;
+        $c->stash->{message} = 'Hello World!';
+        $c->forward('check_message'); # $c is automatically included
+    }
+
+    sub check_message : Private {
+        my ( $self, $c ) = @_;
+        return unless $c->stash->{message};
+        $c->forward('show_message');
+    }
+
+    sub show_message : Private {
+        my ( $self, $c ) = @_;
+        $c->res->body( $c->stash->{message} );
+    }
+
+A C<forward> does not create a new request, so your request object
+(C<$c-E<gt>req>) will remain unchanged. This is a key difference between
+using C<forward> and issuing a redirect.
+
+You can pass new arguments to a C<forward> by adding them
+in an anonymous array. In this case C<$c-E<gt>req-E<gt>args>
+will be changed for the duration of the C<forward> only; upon
+return, the original value of C<$c-E<gt>req-E<gt>args> will
+be reset.
+
+    sub hello : Global {
+        my ( $self, $c ) = @_;
+        $c->stash->{message} = 'Hello World!';
+        $c->forward('check_message',[qw/test1/]);
+        # now $c->req->args is back to what it was before
+    }
+
+    sub check_message : Private {
+        my ( $self, $c ) = @_;
+        my $first_argument = $c->req->args->[0]; # now = 'test1'
+        # do something...
+    }
+
+As you can see from these examples, you can just use the method name as
+long as you are referring to methods in the same controller. If you want
+to forward to a method in another controller, or the main application,
+you will have to refer to the method by absolute path.
+
+  $c->forward('/my/controller/action');
+  $c->forward('/default'); # calls default in main application
+
+Here are some examples of how to forward to classes and methods.
+
+    sub hello : Global {
+        my ( $self, $c ) = @_;
+        $c->forward(qw/MyApp::Model::Hello say_hello/);
+    }
+
+    sub bye : Global {
+        my ( $self, $c ) = @_;
+        $c->forward('MyApp::Model::Hello'); # no method: will try 'process'
+    }
+
+    package MyApp::Model::Hello;
+
+    sub say_hello {
+        my ( $self, $c ) = @_;
+        $c->res->body('Hello World!');
+    }
+
+    sub process {
+        my ( $self, $c ) = @_;
+        $c->res->body('Goodbye World!');
+    }
+
+Note that C<forward> returns to the calling action and continues
+processing after the action finishes. If you want all further processing
+in the calling action to stop, use C<detach> instead, which will execute
+the C<detach>ed action and not return to the calling sub. In both cases,
+Catalyst will automatically try to call process() if you omit the
+method.
+
+
+=head3 Testing
+
+Catalyst has a built-in http server for testing or local
+deployment. (Later, you can easily use a more powerful server, for
+example Apache/mod_perl or FastCGI, in a production environment.)
+
+Start your application on the command line...
+
+    script/myapp_server.pl
+
+...then visit http://localhost:3000/ in a browser to view the output.
+
+You can also do it all from the command line:
+
+    script/myapp_test.pl http://localhost/
+
+Catalyst has a number of tools for actual regression testing of
+applications. The helper scripts will automatically generate basic tests
+that can be extended as you develop your project. To write your own
+comprehensive test scripts, L<Test::WWW::Mechanize::Catalyst> is an
+invaluable tool.
+
+For more testing ideas, see L<Catalyst::Manual::Tutorial::Testing>.
+
+Have fun!
+
+=head1 SEE ALSO
+
+=over 4
+
+=item * L<Catalyst::Manual::About>
+
+=item * L<Catalyst::Manual::Tutorial>
+
+=item * L<Catalyst>
+
+=back
+
+=head1 SUPPORT
+
+IRC:
+
+    Join #catalyst on irc.perl.org.
+    Join #catalyst-dev on irc.perl.org to help with development.
+
+Mailing lists:
+
+    http://lists.rawmode.org/mailman/listinfo/catalyst
+    http://lists.rawmode.org/mailman/listinfo/catalyst-dev
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de> 
+David Naughton, C<naughton@umn.edu>
+Marcus Ramberg, C<mramberg@cpan.org>
+Jesse Sheidlower, C<jester@panix.com>
+Danijel Milicevic, C<me@danijel.de>
+Kieren Diment, C<kd@totaldatasolution.com>
+Yuval Kogman, C<nothingmuch@woobling.org>
+
+=head1 COPYRIGHT
+
+This program is free software. You can redistribute it and/or modify it
+under the same terms as Perl itself.
diff --git a/lib/Catalyst/Manual/Plugins.pod b/lib/Catalyst/Manual/Plugins.pod
new file mode 100644 (file)
index 0000000..4391cb8
--- /dev/null
@@ -0,0 +1,542 @@
+=head1 NAME
+
+Catalyst::Manual::Plugins - Catalyst Plugins (and Components)
+
+=head1 DESCRIPTION
+
+This section lists the some of the plugins and components that are
+available to extend the runtime functionality of Catalyst. Most plugins
+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.
+
+=head1 PLUGINS
+
+=head2 L<Catalyst::Plugin::Account::AutoDiscovery>
+
+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
+text/html served by your Catalyst application.
+
+=head2 L<Catalyst::Plugin::Alarm>
+
+=head2 L<Catalyst::Plugin::AtomPP>
+
+Allows you to dispatch AtomPP methods.
+
+=head2 L<Catalyst::Plugin::AtomServer>
+
+A plugin that implements the necessary bits to make it easy to build an
+Atom API server for any Catalyst-based application.
+
+=head2 L<Catalyst::Plugin::Authentication>
+
+An infrastructure plugin for the Catalyst authentication framework. Now the
+recommended way to do any form of Authentication.
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::Atom>
+
+L<Catalyst::Plugin::Authentication::Credential::Atom> is a plugin which
+implements WSSE and Basic authentication for Catalyst applications using 
+L<Catalyst::Plugin::AtomServer>
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::CHAP>
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::Flickr>
+
+Provides authentication via Flickr, using its API.
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::Hatena>
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::HTTP>
+
+Implements HTTP Basic authentication for Catalyst.
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::JugemKey>
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::PAM>
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::Password>
+
+Takes a username (or userid) and a password, and tries various methods of 
+comparing a password based on what the chosen store's user objects support.
+Part of the Authentication Framework L<Catalyst::Plugin::Authentication>.
+
+=head2 L<Catalyst::Plugin::Authentication::Credential::TypeKey>
+
+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.
+
+=head2 L<Catalyst::Plugin::Authentication::Store::DBIC>
+
+Does authentication and authorization against a L<DBIx::Class> or 
+L<Class::DBI> model.
+
+=head2 L<Catalyst::Plugin::Authentication::Store::Htpasswd>
+
+Uses L<Authen::Htpasswd> to let your application use C<.htpasswd> files for its 
+authentication storage.
+
+=head2 L<Catalyst::Plugin::Authentication::Store::HTTP>
+
+=head2 L<Catalyst::Plugin::Authentication::Store::LDAP>
+
+Authenticates users using an LDAP server.
+
+=head2 L<Catalyst::Plugin::Authentication::Store::Minimal>
+
+Lets you create a very quick and dirty user database in your application's 
+config hash. Great for getting up and running quickly.
+
+=head2 L<Catalyst::Plugin::Authentication::User::Hash>
+
+An easy authentication user object based on hashes. 
+See L<Catalyst::Plugin::Authentication::Store::Minimal> for more info.
+
+=head2 L<Catalyst::Plugin::Authorization::ACL>
+
+This module provides Access Control List style path protection, with arbitrary 
+rules for L<Catalyst> applications. It operates only on the Catalyst private 
+namespace, at least at the moment.
+
+=head2 L<Catalyst::Plugin::Authorization::Roles>
+
+L<Catalyst::Plugin::Authorization::Roles> provides role based authorization 
+for Catalyst based on L<Catalyst::Plugin::Authentication>. 
+
+=head2 L<Catalyst::Plugin::AutoSession>
+
+=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.
+
+=head2 Catalyst::Plugin::Cache::FastMmap, FileCache, BerkeleyDB, and Memcached
+
+L<Catalyst::Plugin::Cache::FastMmap>,
+L<Catalyst::Plugin::Cache::FileCache>,
+L<Catalyst::Plugin::Cache::BerkeleyDB>, and
+L<Catalyst::Plugin::Cache::Memcached> all provide a cache method
+enabling easy access to a shared cache.
+
+=head2 L<Catalyst::Plugin::Captcha>
+
+=head2 L<Catalyst::Plugin::CGI::Untaint>
+
+=head2 L<Catalyst::Plugin::Charsets::Japanese>
+
+=head2 L<Catalyst::Plugin::Compress::Bzip2>
+
+=head2 L<Catalyst::Plugin::Compress::Deflate>
+
+=head2 L<Catalyst::Plugin::Compress::Gzip>
+
+=head2 L<Catalyst::Plugin::Compress::Zlib>
+
+=head2 L<Catalyst::Plugin::ConfigLoader>
+
+Provides a standard method for loading config files. Support
+exists for various formats. See
+L<Catalyst::Plugin::ConfigLoader::INI>,
+L<Catalyst::Plugin::ConfigLoader::JSON>,
+L<Catalyst::Plugin::ConfigLoader::Perl>,
+L<Catalyst::Plugin::ConfigLoader::XML>, and
+L<Catalyst::Plugin::ConfigLoader::YAML>
+
+=head2 L<Catalyst::Plugin::ConfigurablePathTo>
+
+=head2 L<Catalyst::Plugin::Continuation>
+
+=head2 L<Catalyst::Plugin::DateTime>
+
+=head2 L<Catalyst::Plugin::DefaultEnd>
+
+Creates a sane, standard end method for your application.
+
+=head2 L<Catalyst::Plugin::Devel::InPageLogs>
+
+=head2 L<Catalyst::Plugin::Devel::InPageLogs::Log>
+
+=head2 L<Catalyst::Plugin::Dojo>
+
+=head2 L<Catalyst::Plugin::Dumper>
+
+=head2 L<Catalyst::Plugin::Email>
+
+Sends email with L<Email::Send> and L<Email::MIME::Creator>.
+
+=head2 L<Catalyst::Plugin::Email::Japanese>
+
+=head2 L<Catalyst::Plugin::Email::Page>
+
+=head2 L<Catalyst::Plugin::EmailValid>
+
+=head2 L<Catalyst::Plugin::FillInForm>
+
+A plugin based on C<HTML::FillInForm>, which describes itself as a module
+to automatically insert data from a previous HTML form into the HTML input,
+textarea, radio buttons, checkboxes, and select tags.  C<HTML::FillInForm>
+is a subclass of C<HTML::Parser> and uses it to parse the HTML and insert
+the values into the form tags.
+
+=head2 L<Catalyst::Plugin::Flavour>
+
+=head2 L<Catalyst::Plugin::FormValidator>
+
+A form validator plugin that uses L<Data::FormValidator> to validate and
+set up form data from your request parameters. It's a quite thin wrapper
+around that module, so most of the relevant information can be found there.
+
+=head2 L<Catalyst::Plugin::FormValidator::Simple>
+
+=head2 L<Catalyst::Plugin::Geography>
+
+Allows you to retrieve various kinds of geographical information. You can
+retrieve the country or code from the current user, from a given IP
+address, or from a given hostname.
+
+=head2 L<Catalyst::Plugin::Geography::Implementation>
+
+=head2 L<Catalyst::Plugin::HashedCookies>
+
+=head2 L<Catalyst::Plugin::HTML::Scrubber>
+
+=head2 L<Catalyst::Plugin::HTML::Widget>
+
+=head2 L<Catalyst::Plugin::I18N>
+
+An internationalization plugin for Catalyst. Supports C<mo>/C<po> files
+and Maketext classes under your application's I18N namespace.
+
+=head2 L<Catalyst::Plugin::JSONRPC>
+
+=head2 L<Catalyst::Plugin::Markdown>
+
+=head2 L<Catalyst::Plugin::Message>
+
+=head2 L<Catalyst::Plugin::MobileAgent>
+
+=head2 L<Catalyst::Plugin::Observe>
+
+Provides the ability to register AOP-like callbacks to specific Engine
+events. Subclasses L<Class::Publisher>.
+
+=head2 L<Catalyst::Plugin::OrderedParams>
+
+Adjusts the way that parameters operate, causing them to appear in the same
+order they were submitted by the browser. This can be useful for creating
+things such as email forms.
+
+=head2 L<Catalyst::Plugin::PageCache>
+
+Helps improve the performance of slow or frequently accessed pages by
+caching the entire output of your page. Subsequent requests to the page
+will receive the page very quickly from cache.
+
+=head2 L<Catalyst::Plugin::Params::Nested>
+
+=head2 L<Catalyst::Plugin::Params::Nested::Expander>
+
+=head2 L<Catalyst::Plugin::Pluggable>
+
+A plugin for pluggable Catalyst applications.
+
+=head2 L<Catalyst::Plugin::Prototype>
+
+A plugin for the Prototype JavaScript library. This Plugin allows you to
+easily implement AJAX functionality without actually knowing Javascript.
+
+=head2 L<Catalyst::Plugin::Redirect>
+
+=head2 L<Catalyst::Plugin::RequestToken>
+
+=head2 L<Catalyst::Plugin::RequireSSL>
+
+Use this if you would like to force visitors to access certain pages using
+only SSL mode. An attempt to access the page in non-SSL mode will receive a
+redirect into SSL mode. Useful for login pages, shopping carts, user
+registration forms, and other sensitive data.
+
+=head2 L<Catalyst::Plugin::Scheduler>
+
+=head2 L<Catalyst::Plugin::Session>
+
+The L<Catalyst::Plugin::Session> series of modules provide an easy way to
+include session handling in an application. You can choose from several
+different backend storage methods and combine that with your choice of
+client-side storage methods.
+
+=head2 L<Catalyst::Plugin::Session::PerUser>
+
+=head2 L<Catalyst::Plugin::Session::State>
+
+=head2 L<Catalyst::Plugin::Session::State::Cookie>
+
+=head2 L<Catalyst::Plugin::Session::State::URI>
+
+=head2 L<Catalyst::Plugin::Session::Store>
+
+=head2 L<Catalyst::Plugin::Session::Store::CDBI>
+
+=head2 L<Catalyst::Plugin::Session::Store::DBI>
+
+=head2 L<Catalyst::Plugin::Session::Store::DBIC>
+
+=head2 L<Catalyst::Plugin::Session::Store::Dummy>
+
+=head2 L<Catalyst::Plugin::Session::Store::FastMmap>
+
+=head2 L<Catalyst::Plugin::Session::Store::File>
+
+=head2 L<Catalyst::Plugin::Session::Store::Memcached>
+
+=head2 L<Catalyst::Plugin::Session::Test::Store>
+
+=head2 L<Catalyst::Plugin::Singleton>
+
+=head2 L<Catalyst::Plugin::Snippets>
+
+=head2 L<Catalyst::Plugin::SRU>
+
+Allows your controller class to dispatch SRU actions (C<explain>, C<scan>,
+and C<searchRetrieve>) from its own class.
+
+=head2 L<Catalyst::Plugin::StackTrace>
+
+=head2 L<Catalyst::Plugin::Static>
+
+L<Catalyst::Plugin::Static> is a plugin to serve static files from
+C<< $c->config->{root} >>. Intended chiefly for development
+purposes.
+
+=head2 L<Catalyst::Plugin::Static::Simple>
+
+Serves static files in your application without requiring a single line of
+code. This plugin is now included in the core Catalyst distribution.
+
+=head2 L<Catalyst::Plugin::SubRequest>
+
+A plugin to allow subrequests to actions to be made within Catalyst. Nice
+for portal software and such.
+
+=head2 L<Catalyst::Plugin::SuperForm>
+
+An interface to the L<HTML::SuperForm> module, enabling easy HTML form
+creation.
+
+=head2 L<Catalyst::Plugin::Textile>
+
+A persistent Textile processor for Catalyst that uses C<Text::Textile>, a
+Perl-based implementation of Dean Allen's Textile syntax. Textile is
+shorthand for doing common formatting tasks (see L<http://textism.com>).
+
+=head2 L<Catalyst::Plugin::Unicode>
+
+Provides a Unicode-aware Catalyst. On request, it decodes all params from
+UTF-8 octets into a sequence of logical characters. On response, it encodes
+the body into UTF-8 octets.
+
+=head2 L<Catalyst::Plugin::Unicode::Encoding>
+
+=head2 L<Catalyst::Plugin::Upload::Basename>
+
+=head2 L<Catalyst::Plugin::Upload::MD5>
+
+=head2 L<Catalyst::Plugin::Upload::MIME>
+
+=head2 L<Catalyst::Plugin::UploadProgress>
+
+=head2 L<Catalyst::Plugin::XMLRPC>
+
+Allows your Controller class to dispatch XMLRPC methods from its own class.
+
+=head1 CONTROLLERS
+
+=head2 L<Catalyst::Controller::BindLex>
+
+Lets you mark lexical variables with a C<Stashed> attribute, automatically
+passing them to the stash.
+
+=head1 MODELS
+
+=head2 L<Catalyst::Model::CDBI>
+
+The C<Class::DBI> (CDBI) model class.  It is built on top of
+C<Class::DBI::Loader>, which automates the definition of C<Class::DBI>
+sub-classes by scanning the underlying table schemas, setting up columns
+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.
+
+=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>.
+
+=head2 L<Catalyst::Model::EVDB>
+
+=head2 L<Catalyst::Model::File>
+
+=head2 L<Catalyst::Model::Gedcom>
+
+=head2 L<Catalyst::Model::LDAP>
+
+=head2 L<Catalyst::Model::NetBlogger>
+
+=head2 L<Catalyst::Model::Plucene>
+
+A model class for the Plucene search engine.
+
+=head2 L<Catalyst::Model::Proxy>
+
+=head2 L<Catalyst::Model::SVN>
+
+=head2 L<Catalyst::Model::Xapian>
+
+A model class for the Xapian search engine.
+
+=head1 VIEWS
+
+=head2 L<Catalyst::View::Atom::XML>
+
+=head2 L<Catalyst::View::Chart::Strip>
+
+=head2 L<Catalyst::View::CSS::Squish>
+
+=head2 L<Catalyst::View::Embperl>
+
+=head2 L<Catalyst::View::GD::Barcode>
+
+=head2 L<Catalyst::View::GraphViz>
+
+=head2 L<Catalyst::View::HTML::Template>
+
+A view component for rendering pages with L<HTML::Template>.
+
+=head2 L<Catalyst::View::Jemplate>
+
+=head2 L<Catalyst::View::JSON>
+
+=head2 L<Catalyst::View::Mason>
+
+A view component for rendering pages with L<HTML::Mason>.
+
+=head2 L<Catalyst::View::MicroMason>
+
+=head2 L<Catalyst::View::PHP>
+
+=head2 L<Catalyst::View::PSP>
+
+A view component for rendering pages using PSP, a Perl extension
+implementing a JSP-like templating system. See L<Text::PSP>.
+
+=head2 L<Catalyst::View::Petal>
+
+A view component for rendering pages using Petal, the Perl Template
+Attribute Language, an XML-based templating system. See L<Petal>.
+
+=head2 L<Catalyst::View::TT>
+
+A view component for rendering pages with Template Toolkit. See
+L<Template::Manual>.
+
+=head2 L<Catalyst::View::XSLT>
+
+=head2 L<Catalyst::View::vCard>
+
+=head1 OBSOLETE MODULES
+
+=head2 L<Catalyst::Model::DBIC>
+
+Replaced by L<Catalyst::Model::DBIC::Schema>.
+
+=head2 L<Catalyst::Plugin::Authentication::Basic::Remote>
+
+Replaced by L<Catalyst::Plugin::Authentication::Credential::HTTP>.
+
+=head2 L<Catalyst::Plugin::Authentication::CDBI>
+
+Replaced by L<Catalyst::Plugin::Authentication::Store::DBIC>.
+
+=head2 L<Catalyst::Plugin::Authentication::CDBI::Basic>
+
+Replaced by L<Catalyst::Plugin::Authentication::Credential::HTTP>.
+
+=head2 L<Catalyst::Plugin::Authentication::LDAP>
+
+Replaced by L<Catalyst::Plugin::Authentication::Store::LDAP>.
+
+=head2 L<Catalyst::Plugin::Authentication::Simple>
+
+Replaced by L<Catalyst::Plugin::Authentication>.
+
+=head2 L<Catalyst::Plugin::Authorization::CDBI::GroupToken>
+
+=head2 L<Catalyst::Plugin::CDBI::Transaction>
+
+=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.
+
+=head2 L<Catalyst::Plugin::DefaultEnd>
+
+Replaced by L<Catalyst::Action::RenderView>
+
+=head2 L<Catalyst::Plugin::SanitizeUrl>
+
+=head2 L<Catalyst::Plugin::SanitizeUrl::PrepAction>
+
+=head2 Catalyst::Plugin::Session::*
+
+The L<Catalyst::Plugin::Session::CGISession>, 
+L<Catalyst::Plugin::Session::FastMmap>,
+L<Catalyst::Plugin::Session::Flex>, and
+L<Catalyst::Plugin::Session::Manager>
+modules have been replaced by the <Catalyst::Plugin::Session> framework.
+
+=head1 AUTHORS
+
+Andrew Ford E<lt>A.Ford@ford-mason.co.ukE<gt>
+
+Gavin Henry E<lt>ghenry@suretecsystems.comE<gt>
+
+Jesse Sheidlower E<lt>jester@panix.comE<gt>
+
+Marcus Ramberg E<lt>mramberg@cpan.orgE<gt>
+
+David Kamholz E<lt>dkamholz@cpan.orgE<gt>
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it under
+the same terms as Perl itself.
+
diff --git a/lib/Catalyst/Manual/Tutorial/README b/lib/Catalyst/Manual/Tutorial/README
new file mode 100644 (file)
index 0000000..517893b
--- /dev/null
@@ -0,0 +1,4 @@
+The tutorial is now located in Task::Catalyst::Tutorial.  See:\r
+\r
+http://dev.catalyst.perl.org/repos/Catalyst/trunk/Task-Catalyst-Tutorial/lib/Catalyst/Manual/Tutorial/\r
+\r
diff --git a/lib/Catalyst/Manual/WritingPlugins.pod b/lib/Catalyst/Manual/WritingPlugins.pod
new file mode 100644 (file)
index 0000000..5af1713
--- /dev/null
@@ -0,0 +1,254 @@
+=head1 NAME
+
+Catalyst::Manual::WritingPlugins - An introduction to writing plugins
+with L<NEXT>.
+
+=head1 DESCRIPTION
+
+Writing an integrated plugin for L<Catalyst> using L<NEXT>.
+
+=head1 WHY PLUGINS?
+
+A Catalyst plugin is an integrated part of your application. By writing
+plugins you can, for example, perform processing actions automatically,
+instead of having to C<forward> to a processing method every time you
+need it.
+
+=head1 WHAT'S NEXT?
+
+L<NEXT> is used to re-dispatch a method call as if the calling method
+doesn't exist at all. In other words: If the class you're inheriting
+from defines a method, and you're overloading that method in your own
+class, NEXT gives you the possibility to call that overloaded method.
+
+This technique is the usual way to plug a module into Catalyst.
+
+=head1 INTEGRATING YOUR PLUGIN
+
+You can use L<NEXT> for your plugin by overloading certain methods which
+are called by Catalyst during a request.
+
+=head2 The request life-cycle
+
+Catalyst creates a context object (C<$context> or, more usually, its
+alias C<$c>) on every request, which is passed to all the handlers that
+are called from preparation to finalization.
+
+For a complete list of the methods called during a request, see
+L<Catalyst::Manual::Internals>. The request can be split up in three
+main stages:
+
+=over 4
+
+=item preparation
+
+When the C<prepare> handler is called, it initializes the request
+object, connections, headers, and everything else that needs to be
+prepared. C<prepare> itself calls other methods to delegate these tasks.
+After this method has run, everything concerning the request is in
+place.
+
+=item dispatch
+
+The dispatching phase is where the black magic happens. The C<dispatch>
+handler decides which actions have to be called for this request.
+
+=item finalization
+
+Catalyst uses the C<finalize> method to prepare the response to give to
+the client. It makes decisions according to your C<response> (e.g. where
+you want to redirect the user to). After this method, the response is
+ready and waiting for you to do something with it--usually, hand it off
+to your View class.
+
+=back
+
+=head2 What Plugins look like
+
+There's nothing special about a plugin except its name. A module named
+C<Catalyst::Plugin::MyPlugin> will be loaded by Catalyst if you specify it
+in your application class, e.g.:
+
+    # your plugin
+    package Catalyst::Plugin::MyPlugin;
+    use warnings;
+    use strict;
+    ...
+
+    # MyApp.pm, your application class
+    use Catalyst qw/-Debug MyPlugin/;
+
+This does nothing but load your module. We'll now see how to overload stages of the request cycle, and provide accessors.
+
+=head2 Calling methods from your Plugin
+
+Methods that do not overload a handler are available directly in the
+C<$c> context object; they don't need to be qualified with namespaces,
+and you don't need to C<use> them.
+
+    package Catalyst::Plugin::Foobar;
+    use strict;
+    sub foo { return 'bar'; }
+
+    # anywhere else in your Catalyst application:
+
+    $c->foo(); # will return 'bar'
+
+That's it.
+
+=head2 Overloading - Plugging into Catalyst
+
+If you don't just want to provide methods, but want to actually plug
+your module into the request cycle, you have to overload the handler
+that suits your needs.
+
+Every handler gets the context object passed as its first argument. Pass
+the rest of the arguments to the next handler in row by calling it via
+
+    $c->NEXT::handler-name( @_ );
+
+if you already C<shift>ed it out of C<@_>. Remember to C<use> C<NEXT>.
+
+=head2 Storage and Configuration
+
+Some Plugins use their accessor names as a storage point, e.g.
+
+  sub my_accessor {
+    my $c = shift;
+    $c->{my_accessor} = ..
+
+but it is more safe and clear to put your data in your configuration
+hash:
+
+    $c->config->{my_plugin}{ name } = $value;
+
+If you need to maintain data for more than one request, you should
+store it in a session.
+
+=head1 EXAMPLE
+
+Here's a simple example Plugin that shows how to overload C<prepare> 
+to add a unique ID to every request:
+
+    package Catalyst::Plugin::RequestUUID;
+
+    use warnings;
+    use strict;
+
+    use Catalyst::Request;
+    use Data::UUID;
+    use NEXT;    
+
+    our $VERSION = 0.01;
+
+    {   # create a uuid accessor
+        package Catalyst::Request;
+        __PACKAGE__->mk_accessors('uuid');
+    }
+
+    sub prepare {
+      my $class = shift;
+
+      # Turns the engine-specific request into a Catalyst context .
+      my $c = $class->NEXT::prepare( @_ );
+
+      $c->request->uuid( Data::UUID->new->create_str );
+      $c->log->debug( 'Request UUID "'. $c->request->uuid .'"' );
+
+      return $c;
+    }
+
+    1;
+
+Let's just break it down into pieces:
+
+    package Catalyst::Plugin::RequestUUID;
+
+The package name has to start with C<Catalyst::Plugin::> to make sure you
+can load your plugin by simply specifying
+
+    use Catalyst qw/RequestUUID/;
+
+in the application class. L<warnings> and L<strict> are recommended for
+all Perl applications.
+
+    use NEXT;
+    use Data::UUID;
+    our $VERSION = 0.01;
+
+NEXT must be explicitly C<use>d. L<Data::UUID> generates our unique
+ID. The C<$VERSION> gets set because it's a) a good habit and b)
+L<ExtUtils::ModuleMaker> likes it.
+
+    sub prepare {
+
+These methods are called without attributes (Private, Local, etc.).
+
+    my $c = shift;
+
+We get the context object for this request as the first argument. 
+
+B<Hint!>:Be sure you shift the context object out of C<@_> in this. If
+you just do a
+
+  my ( $c ) = @_;
+
+it remains there, and you may run into problems if you're not aware of
+what you pass to the handler you've overloaded. If you take a look at
+
+    $c = $c->NEXT::prepare( @_ );
+
+you see you would pass the context twice here if you don't shift it out
+of your parameter list.
+
+This line is the main part of the plugin procedure. We call the
+overloaded C<prepare> method and pass along the parameters we got. We
+also overwrite the context object C<$c> with the one returned by the
+called method returns. We'll return our modified context object at the
+end.
+
+Note that that if we modify C<$c> before this line, we also modify it
+before the original (overloaded) C<prepare> is run. If we modify it
+after, we modify an already prepared context. And, of course, it's no
+problem to do both, if you need to. Another example of working on the
+context before calling the actual handler would be setting header
+information before C<finalize> does its job.
+
+    $c->req->{req_uuid} = Data::UUID->new->create_str;
+
+This line creates a new L<Data::UUID> object and calls the C<create_str>
+method. The value is saved in our request, under the key C<req_uuid>. We
+can use that to access it in future in our application.
+
+    $c->log->debug( 'Request UUID "'. $c->req->{req_uuid} .'"' );
+
+This sends our UUID to the C<debug> log.
+
+The final line
+
+    return $c;
+
+passes our modified context object back to whoever has called us. This
+could be Catalyst itself, or the overloaded handler of another plugin.
+
+=head1 SEE ALSO
+
+L<Catalyst>, L<NEXT>, L<ExtUtils::ModuleMaker>, L<Catalyst::Manual::Plugins>,
+L<Catalyst::Manual::Internals>.
+
+=head1 THANKS TO
+
+Sebastian Riedel and his team of Catalyst developers as well as all the
+helpful people in #catalyst.
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=head1 AUTHOR
+
+S<Robert Sedlacek, C<phaylon@dunkelheit.at>> with a lot of help from the
+people on #catalyst.
+
+=cut