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 =head2 L<Part 3: Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
172 Include a Create Action in the Books Controller
176 Include a Template for the url_create Action:
180 Try the url_create Feature
186 MANUALLY BUILDING A CREATE FORM
192 Add a Method to Display the Form
196 Add a Template for the Form
200 Add Method to Process Form Values and Update Database
210 A SIMPLE DELETE FEATURE
216 Include a Delete Link in the List
220 Add a Delete Action to the Controller
224 Try the Delete Feature
230 =head2 L<Part 4: Authentication|Catalyst::Manual::Tutorial::Authentication>
242 Add Users and Roles to the Database
246 Add User and Role Information to DBIC Schema
250 Create New ``Result Source Objects''
254 Sanity-Check Reload of Development Server
258 Include Authentication and Session Plugins
262 Configure Authentication
266 Add Login and Logout Controllers
270 Add a Login Form TT Template Page
278 Displaying Content Only to Authenticated Users
282 Try Out Authentication
288 USING PASSWORD HASHES
294 Get a SHA-1 Hash for the Password
298 Switch to SHA-1 Password Hashes in the Database
302 Enable SHA-1 Hash Passwords in Catalyst::Plugin::Authentication::Store::DBIC
306 Try Out the Hashed Passwords
312 =head2 L<Part 5: Authorization|Catalyst::Manual::Tutorial::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
366 =head2 L<Part 6: Debugging|Catalyst::Manual::Tutorial::Debugging>
376 RUNNING CATALYST UNDER THE PERL DEBUGGER
380 DEBUGGING MODULES FROM CPAN
384 =head2 L<Part 7: Testing|Catalyst::Manual::Tutorial::Testing>
390 RUNNING THE "CANNED" CATALYST TESTS
394 RUNNING A SINGLE TEST
398 ADDING YOUR OWN TEST SCRIPT
402 SUPPORTING BOTH PRODUCTION AND TEST DATABASES
406 =head2 L<Part 8: Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
412 HTML::WIDGET FORM CREATION
418 Add the HTML::Widget Plugin
422 Add a Form Creation Helper Method
426 Add Actions to Display and Save the Form
434 Create a Template Page To Display The Form
438 Add Links for Create and Update via HTML::Widget
442 Test The <HTML::Widget> Create Form
448 HTML::WIDGET VALIDATION AND FILTERING
454 Add Constraints and Filters to the Widget Creation Method
458 Rebuild the Form Submission Method to Include Validation
468 Enable DBIx::Class::HTMLWidget Support
474 Add DBIx::Class::HTMLWidget to DBIC Model
478 Use populate_from_widget in hw_create_do
484 =head2 L<Part 9: Appendices|Catalyst::Manual::Tutorial::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
522 APPENDIX 3: IMPROVED HASHING SCRIPT
529 This tutorial would not have been possible without the input of many
530 different people in the Catalyst community. In particular, the
531 primary author would like to thank:
537 Sebastian Riedel for founding the Catalyst project.
541 The members of the Catalyst Core Team for their tireless efforts to
542 advance the Catalyst project. Although all of the Core Team members
543 have played a key role in this tutorial, it would have never been
544 possible without the critical contributions of: Matt Trout, for his
545 unfathomable knowledge of all things Perl and Catalyst (and his
546 willingness to answer lots of my questions); Jesse Sheidlower, for his
547 incredible skill with the written word and dedication to improving the
548 Catalyst documentation; and Yuval Kogman, for his work on the Catalyst
549 "Auth & Authz" plugins (the original focus of the tutorial) and other
550 key Catalyst modules.
554 Other Catalyst documentation folks like Kieren Diment, Gavin Henry,
555 and Jess Robinson (including their work on the original Catalyst
560 Everyone on #catalyst and #catalyst-dev.
564 People who have emailed me with corrections and suggestions on the
565 tutorial. As of the most recent release, this include: Florian Ragwitz,
566 Mauro Andreolini, Jim Howard, Giovanni Gigante, William Moreno,
567 Bryan Roach, Ashley Berlin, David Kamholz, Kevin Old, Henning Sprang,
576 Kennedy Clark, C<hkclark@gmail.com>
578 Please report any errors, issues or suggestions to the author. The
579 most recent version of the Catalyst Tutorial can be found at
580 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
582 Copyright 2006, Kennedy Clark, under Creative Commons License
583 (L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).