3 Catalyst::Manual::Tutorial - Catalyst Tutorial: Overview
7 The Catalyst framework is a flexible and comprehensive environment for
8 quickly building high-functionality web applications. This tutorial is
9 designed to provide a rapid introduction to its basics and its most
10 commonly used features while focusing on real-world best practices.
12 The tutorial is divided into the following sections:
14 B<NOTE:> CLICK THESE LINKS TO JUMP TO CHAPTERS (the index links above
15 only navigate inside this page).
21 L<Introduction|Catalyst::Manual::Tutorial::Intro>
25 L<Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
29 L<Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
33 L<Authentication|Catalyst::Manual::Tutorial::Authentication>
37 L<Authorization|Catalyst::Manual::Tutorial::Authorization>
41 L<Debugging|Catalyst::Manual::Tutorial::Debugging>
45 L<Testing|Catalyst::Manual::Tutorial::Testing>
49 L<Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
53 L<Appendices|Catalyst::Manual::Tutorial::Appendices>
57 A tarball of the final application is available at
58 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/Final_Tarball/MyApp.tgz>.
61 =head1 Detailed Table of Contents
63 =head2 L<Part 1: Introduction|Catalyst::Manual::Tutorial::Intro>
69 VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
81 WHERE TO GET WORKING CODE
86 =head2 L<Part 2: Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
92 CREATE A CATALYST PROJECT
96 CREATE A SQLITE DATABASE
100 EDIT THE LIST OF CATALYST PLUGINS
104 DATABASE ACCESS WITH DBIx::Class
111 Create a DBIC Schema File
115 Create the DBIC ``Result Source'' Files
119 Use Catalyst::Model::DBIC::Schema to Load the Model Class
126 CREATE A CATALYST CONTROLLER
137 Create a Catalyst View Using TTSite
141 Using RenderView for the Default View
145 Globally Customize Every View
149 Create a TT Template Page
160 USING THE DEFAULT TEMPLATE NAME
164 =head2 L<Part 3: Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
176 Include a Create Action in the Books Controller
180 Include a Template for the url_create Action:
184 Try the url_create Feature
190 MANUALLY BUILDING A CREATE FORM
196 Add a Method to Display the Form
200 Add a Template for the Form
204 Add Method to Process Form Values and Update Database
214 A SIMPLE DELETE FEATURE
220 Include a Delete Link in the List
224 Add a Delete Action to the Controller
228 Try the Delete Feature
234 =head2 L<Part 4: Authentication|Catalyst::Manual::Tutorial::Authentication>
246 Add Users and Roles to the Database
250 Add User and Role Information to DBIC Schema
254 Create New ``Result Source Objects''
258 Sanity-Check Reload of Development Server
262 Include Authentication and Session Plugins
266 Configure Authentication
270 Add Login and Logout Controllers
274 Add a Login Form TT Template Page
282 Displaying Content Only to Authenticated Users
286 Try Out Authentication
292 USING PASSWORD HASHES
298 Get a SHA-1 Hash for the Password
302 Switch to SHA-1 Password Hashes in the Database
306 Enable SHA-1 Hash Passwords in Catalyst::Plugin::Authentication::Store::DBIC
310 Try Out the Hashed Passwords
316 =head2 L<Part 5: Authorization|Catalyst::Manual::Tutorial::Authorization>
328 Update Plugins to Include Support for Authorization
332 Add Config Information for Authorization
336 Add Role-Specific Logic to the ``Book List'' Template
340 Limit Books::add to admin Users
344 Try Out Authentication And Authorization
350 ENABLE ACL-BASED AUTHORIZATION
356 Add the Catalyst::Plugin::Authorization::ACL Plugin
360 Add ACL Rules to the Application Class
364 Add a Method to Handle Access Violations
370 =head2 L<Part 6: Debugging|Catalyst::Manual::Tutorial::Debugging>
380 RUNNING CATALYST UNDER THE PERL DEBUGGER
384 DEBUGGING MODULES FROM CPAN
388 =head2 L<Part 7: Testing|Catalyst::Manual::Tutorial::Testing>
394 RUNNING THE "CANNED" CATALYST TESTS
398 RUNNING A SINGLE TEST
402 ADDING YOUR OWN TEST SCRIPT
406 SUPPORTING BOTH PRODUCTION AND TEST DATABASES
410 =head2 L<Part 8: Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
416 HTML::WIDGET FORM CREATION
422 Add the HTML::Widget Plugin
426 Add a Form Creation Helper Method
430 Add Actions to Display and Save the Form
438 Create a Template Page To Display The Form
442 Add Links for Create and Update via HTML::Widget
446 Test The <HTML::Widget> Create Form
452 HTML::WIDGET VALIDATION AND FILTERING
458 Add Constraints and Filters to the Widget Creation Method
462 Rebuild the Form Submission Method to Include Validation
472 Enable DBIx::Class::HTMLWidget Support
478 Add DBIx::Class::HTMLWidget to DBIC Model
482 Use populate_from_widget in hw_create_do
488 =head2 L<Part 9: Appendices|Catalyst::Manual::Tutorial::Appendices>
494 APPENDIX 1: CUT AND PASTE FOR POD-BASED EXAMPLES
500 "Un-indenting" with Vi/Vim
504 "Un-indenting" with Emacs
510 APPENDIX 2: USING MYSQL AND POSTGRESQL
526 APPENDIX 3: IMPROVED HASHING SCRIPT
533 This tutorial would not have been possible without the input of many
534 different people in the Catalyst community. In particular, the
535 primary author would like to thank:
541 Sebastian Riedel for founding the Catalyst project.
545 The members of the Catalyst Core Team for their tireless efforts to
546 advance the Catalyst project. Although all of the Core Team members
547 have played a key role in this tutorial, it would have never been
548 possible without the critical contributions of: Matt Trout, for his
549 unfathomable knowledge of all things Perl and Catalyst (and his
550 willingness to answer lots of my questions); Jesse Sheidlower, for his
551 incredible skill with the written word and dedication to improving the
552 Catalyst documentation; and Yuval Kogman, for his work on the Catalyst
553 "Auth & Authz" plugins (the original focus of the tutorial) and other
554 key Catalyst modules.
558 Other Catalyst documentation folks like Kieren Diment, Gavin Henry,
559 and Jess Robinson (including their work on the original Catalyst
564 Everyone on #catalyst and #catalyst-dev.
568 People who have emailed me with corrections and suggestions on the
569 tutorial. As of the most recent release, this include: Florian Ragwitz,
570 Mauro Andreolini, Jim Howard, Giovanni Gigante, William Moreno,
571 Bryan Roach, Ashley Berlin, David Kamholz, Kevin Old, Henning Sprang,
572 Jeremy Jones, David Kurtz, and Ingo Wichmann.
578 Kennedy Clark, C<hkclark@gmail.com>
580 Please report any errors, issues or suggestions to the author. The
581 most recent version of the Catalyst Tutorial can be found at
582 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
584 Copyright 2006, Kennedy Clark, under Creative Commons License
585 (L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).