Day 10 - The Chained Dispatch Type
A complete example of how to use Catalyst::DispatchType::Chained.
A basic introduction to Chained actions with Catalyst.
Frequently when building web applications there is a chain of dependency along the url path. That is, the controller dispatch logic has a close relationship to the data you want to draw from the model. Chained dispatch types provide an easy way to encapsulate this logic within your Catalyst controllers.
This Advent calendar entry is associated with a complete example application which shows how to use chained actions to provide this logic. The example application is available from the Catalyst subversion repository by issuing the following command:
$ svn co http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/ChainedEg
Please get a copy of this code before you proceed. The application is a very simple proof-of-concept application which will work with a basic Catalyst. There is no model, and the view is handled in the Root controller's end action (i.e. Controller::Root->end).
As an interesting aside, with appropriate introspection, by using Class::Inspector for example, it would be relatively straightforward to develop a custom view based on this end action to provide skeleton output during application development. For instance, you might want to use this in a situation where you have a pre-existing model but are not yet able to provide data for it.