3 Catalyst::Manual::Tutorial - Catalyst Tutorial: Overview
9 The Catalyst framework is a flexible and comprehensive environment for
10 quickly building high-functionality web applications. This tutorial is
11 design to provide a rapid introduction to its basics and most commonly
12 used features while focusing on real-world best practices.
14 The tutorial is broken down into the following sections:
20 L<Introduction|Catalyst::Manual::Tutorial_Intro>
24 L<Catalyst Basics|Catalyst::Manual::Tutorial_CatalystBasics>
28 L<CRUD|Catalyst::Manual::Tutorial_BasicCRUD>
32 L<Authentication|Catalyst::Manual::Tutorial_Authentication>
36 L<Authorization|Catalyst::Manual::Tutorial_Authorization>
40 L<Debugging|Catalyst::Manual::Tutorial_Debugging>
44 L<Testing|Catalyst::Manual::Tutorial_Testing>
48 L<CRUD|Catalyst::Manual::Tutorial_AdvancedCRUD>
52 L<Appendicies|Catalyst::Manual::Tutorial_Appendicies>
57 Full source code is available for each section via the main Catalyst
58 Subversion repository at
59 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/>. See the
60 end of each section for the specifics on retrieving code for that
63 A tarball of the final application is available at
64 C<to_be_compled_in_final_version>.
66 =head1 Detailed Table Of Contents
68 =head2 Part 1: Introduction
74 VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
86 WHERE TO GET WORKING CODE
91 =head2 Part 2: Catalyst Application Development Basics
97 CREATE A CATALYST PROJECT
101 CREATE A SQLITE DATABASE
105 EDIT THE LIST OF CATALYST PLUGINS
109 DATABASE ACCESS WITH DBIx::Class
115 Create a DBIC Schema File
119 Create the DBIC ``Result Source'' Files
123 Use Catalyst::Model::DBIC::Schema To Load The Model Class
129 CREATE A CATALYST CONTROLLER
139 Create a Catalyst View Using TTSITE
143 Globally Customize Every View
147 Create a TT Template Page
158 =head2 Part 3: Basic CRUD
170 Include a Create Action in the Books Controller
174 Include a Template for the url_create Action:
178 Try the url_create Feature
184 MANUALLY BUILDING A CREATE FORM
190 Add Method to Display The Form
194 Add a Template for the Form
198 Add Method to Process Form Values and Update Database
208 A SIMPLE DELETE FEATURE
214 Include a Delete Link in the List
218 Add a Delete Action to the Controller
222 Try the Delete Feature
229 =head2 Part 4: Authentication
241 Add Users and Roles to the Database
245 Add User and Role Information to DBIC Schema
249 Create New ``Result Source Objects''
253 Sanity-Check Reload of Development Server
257 Include Authentication and Session Plugins
261 Configure Authentication
265 Add Login and Logout Controllers
269 Add a Login Form TT Template Page
277 Displaying Content Only to Authenticated Users
281 Try Out Authentication
287 USING PASSWORD HASHES
293 Get a SHA-1 Hash for the Password
297 Switch to SHA-1 Password Hashes in the Database
301 Enable SHA-1 Hash Passwords in Catalyst::Plugin::Authentication::Store::DBIC
305 Try Out the Hashed Passwords
312 =head2 Part 5: Authorization
324 Update Plugins to Include Support for Authorization
328 Add Config Information for Authorization
332 Add Role-Specific Logic to the ``Book List'' Template
336 Limit Books::add to admin Users
340 Try Out Authentication And Authorization
346 ENABLE ACL-BASED AUTHORIZATION
352 Add the Catalyst::Plugin::Authorization::ACL Plugin
356 Add ACL Rules to the Application Class
360 Add a Method to Handle Access Violations
367 =head2 Part 6: Debugging
377 RUNNING CATALYST UNDER THE PERL DEBUGGER
382 =head2 Part 7: Testing
388 RUNNING THE "CANNED" CATALYST TESTS
392 RUNNING A SINGLE TEST
396 ADDING YOUR OWN TEST SCRIPT
400 SUPPORTING BOTH PRODUCTION AND TEST DATABASES
405 =head2 Part 8: Advanced CRUD
411 HTML::WIDGET FORM CREATION
417 Add the HTML::Widget Plugin
421 Add a Form Creation Helper Method
425 Add Actions to Display and Save the Form
433 Create a Template Page To Display The Form
437 Add Links for Create and Update via HTML::Widget
441 Test The <HTML::Widget> Create Form
447 HTML::WIDGET VALIDATION AND FILTERING
453 Add Constraints and Filters to the Widget Creation Method
457 Rebuild the Form Submission Method to Include Validation
467 Enable DBIx::Class::HTMLWidget Support
473 Add DBIx::Class::HTMLWidget to DBIC Model
477 Use populate_from_widget in hw_create_do
484 =head2 Part 9: Appendices
490 APPENDIX 1: CUT AND PASTE FOR POD-BASED EXAMPLES
496 "Un-indenting" with Vi/Vim
500 "Un-indenting" with Emacs
506 APPENDIX 2: USING MYSQL AND POSTGRESQL