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<More Catalyst Basics|Catalyst::Manual::Tutorial::MoreCatalystBasics>
33 L<Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
37 L<Authentication|Catalyst::Manual::Tutorial::Authentication>
41 L<Authorization|Catalyst::Manual::Tutorial::Authorization>
45 L<Debugging|Catalyst::Manual::Tutorial::Debugging>
49 L<Testing|Catalyst::Manual::Tutorial::Testing>
53 L<Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
57 L<Appendices|Catalyst::Manual::Tutorial::Appendices>
61 Final code tarballs for each chapter of the tutorial are available at
62 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/>.
65 =head1 Detailed Table of Contents
68 =head2 L<Chapter 1: Intro|Catalyst::Manual::Tutorial::Intro>
70 Note: Click on the heading in the previous line to jump to the actual
71 chapter. Below is a "table of contents" for this chapter.
77 VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
89 WHERE TO GET WORKING CODE
94 =head2 L<Chapter 2: Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
96 Note: Click on the heading in the previous line to jump to the actual
97 chapter. Below is a "table of contents" for this chapter.
103 CREATE A CATALYST PROJECT
117 Hello, World! Using a View and a Template
123 CREATE A SIMPLE CONTROLLER AND AN ACTION
128 =head2 L<Chapter 3: More Catalyst Basics|Catalyst::Manual::Tutorial::MoreCatalystBasics>
130 Note: Click on the heading in the previous line to jump to the actual
131 chapter. Below is a "table of contents" for this chapter.
137 CREATE A NEW APPLICATION
141 EDIT THE LIST OF CATALYST PLUGINS
145 CREATE A CATALYST CONTROLLER
156 Create a Catalyst View Using TTSite
160 Globally Customize Every View
164 Create a TT Template Page
170 CREATE A SQLITE DATABASE
174 DATABASE ACCESS WITH DBIx::Class
180 Create a Dynamic DBIC Model
190 A STATIC DATABASE MODEL WITH DBIx::Class
196 Create Static DBIC Schema Files
200 Updating the Generated DBIC Schema Files
210 RUNNING THE APPLICATION FROM THE COMMAND LINE
220 Using RenderView for the Default View
224 Using The Default Template Name
228 Return To A Manually-Specified Template
235 =head2 L<Chapter 4: Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
237 Note: Click on the heading in the previous line to jump to the actual
238 chapter. Below is a "table of contents" for this chapter.
250 Include a Create Action in the Books Controller
254 Include a Template for the url_create Action:
258 Try the url_create Feature
264 MANUALLY BUILDING A CREATE FORM
270 Add a Method to Display the Form
274 Add a Template for the Form
278 Add Method to Process Form Values and Update Database
288 A SIMPLE DELETE FEATURE
294 Include a Delete Link in the List
298 Add a Delete Action to the Controller
302 Try the Delete Feature
306 Fixing a Dangerous URL
310 Try the Delete and Redirect Logic
314 Using uri_for to Pass Query Parameters
318 Try the Delete and Redirect With Query Param Logic
325 =head2 L<Chapter 5: Authentication|Catalyst::Manual::Tutorial::Authentication>
327 Note: Click on the heading in the previous line to jump to the actual
328 chapter. Below is a "table of contents" for this chapter.
340 Add Users and Roles to the Database
344 Add User and Role Information to DBIC Schema
348 Sanity-Check Reload of Development Server
352 Include Authentication and Session Plugins
356 Configure Authentication
360 Add Login and Logout Controllers
364 Add a Login Form TT Template Page
372 Displaying Content Only to Authenticated Users
376 Try Out Authentication
382 USING PASSWORD HASHES
388 Get a SHA-1 Hash for the Password
392 Switch to SHA-1 Password Hashes in the Database
396 Enable SHA-1 Hash Passwords in Catalyst::Plugin::Authentication::Store::DBIC
400 Try Out the Hashed Passwords
406 USING THE SESSION FOR FLASH
416 Switch To Flash-To-Stash
423 =head2 L<Chapter 6: Authorization|Catalyst::Manual::Tutorial::Authorization>
425 Note: Click on the heading in the previous line to jump to the actual
426 chapter. Below is a "table of contents" for this chapter.
438 Update Plugins to Include Support for Authorization
442 Add Config Information for Authorization
446 Add Role-Specific Logic to the ``Book List'' Template
450 Limit Books::add to admin Users
454 Try Out Authentication And Authorization
460 ENABLE ACL-BASED AUTHORIZATION
466 Add the Catalyst::Plugin::Authorization::ACL Plugin
470 Add ACL Rules to the Application Class
474 Add a Method to Handle Access Violations
481 =head2 L<Chapter 7: Debugging|Catalyst::Manual::Tutorial::Debugging>
483 Note: Click on the heading in the previous line to jump to the actual
484 chapter. Below is a "table of contents" for this chapter.
494 RUNNING CATALYST UNDER THE PERL DEBUGGER
498 DEBUGGING MODULES FROM CPAN
503 =head2 L<Chapter 8: Testing|Catalyst::Manual::Tutorial::Testing>
505 Note: Click on the heading in the previous line to jump to the actual
506 chapter. Below is a "table of contents" for this chapter.
512 RUNNING THE "CANNED" CATALYST TESTS
516 RUNNING A SINGLE TEST
520 ADDING YOUR OWN TEST SCRIPT
524 SUPPORTING BOTH PRODUCTION AND TEST DATABASES
529 =head2 L<Chapter 9: Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
531 Note: Click on the heading in the previous line to jump to the actual
532 chapter. Below is a "table of contents" for this chapter.
538 ADVANCED CRUD OPTIONS
543 =head2 L<Chapter 10: Appendices|Catalyst::Manual::Tutorial::Appendices>
545 Note: Click on the heading in the previous line to jump to the actual
546 chapter. Below is a "table of contents" for this chapter.
552 APPENDIX 1: CUT AND PASTE FOR POD-BASED EXAMPLES
558 "Un-indenting" with Vi/Vim
562 "Un-indenting" with Emacs
568 APPENDIX 2: USING MYSQL AND POSTGRESQL
584 APPENDIX 3: IMPROVED HASHING SCRIPT
591 This tutorial would not have been possible without the input of many
592 different people in the Catalyst community. In particular, the
593 primary author would like to thank:
599 Sebastian Riedel for founding the Catalyst project.
603 The members of the Catalyst Core Team for their tireless efforts to
604 advance the Catalyst project. Although all of the Core Team members
605 have played a key role in this tutorial, it would have never been
606 possible without the critical contributions of: Matt Trout, for his
607 unfathomable knowledge of all things Perl and Catalyst (and his
608 willingness to answer lots of my questions); Jesse Sheidlower, for his
609 incredible skill with the written word and dedication to improving the
610 Catalyst documentation; and Yuval Kogman, for his work on the Catalyst
611 "Auth & Authz" plugins (the original focus of the tutorial) and other
612 key Catalyst modules.
616 Other Catalyst documentation folks like Kieren Diment, Gavin Henry,
617 and Jess Robinson (including their work on the original Catalyst
622 Kieren Diment for his oversite of Catalyst-related documentation.
626 Everyone on #catalyst and #catalyst-dev.
630 Louis Moore (who thanks Marcello Romani and Tom Lanyon) for the
631 PostgreSQL content in the Appendix.
635 People who have emailed me with corrections and suggestions on the
636 tutorial. As of the most recent release, this include: Florian
637 Ragwitz, Mauro Andreolini, Jim Howard, Giovanni Gigante, William
638 Moreno, Bryan Roach, Ashley Berlin, David Kamholz, Kevin Old, Henning
639 Sprang, Jeremy Jones, David Kurtz, Ingo Wichmann, Shlomi Fish, Murray
640 Walker. Also, thanks to Devin Austin for coming up with an initial
641 version of a non-TTSite wrapper page. I'm sure I am missing some
642 names here... apologies for that (please let me know if you name
649 Kennedy Clark, C<hkclark@gmail.com>
651 Please report any errors, issues or suggestions to the author. The
652 most recent version of the Catalyst Tutorial can be found at
653 L<http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Manual/5.70/trunk/lib/Catalyst/Manual/Tutorial/>.
655 Copyright 2006-2008, Kennedy Clark, under Creative Commons License
656 (L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).