1Catalyst::Manual::TutorUisaelr(3C)ontributed Perl DocumeCnattaatliyosnt::Manual::Tutorial(3)
2
3
4

NAME

6       Catalyst::Manual::Tutorial - Catalyst Tutorial: Overview
7

DESCRIPTION

9       The Catalyst framework is a flexible and comprehensive environment for
10       quickly building high-functionality web applications.  This tutorial is
11       designed to provide a rapid introduction to its basics and its most
12       commonly used features while focusing on real-world best practices.
13
14       The tutorial is divided into the following sections:
15
16       NOTE: CLICK THESE LINKS TO JUMP TO CHAPTERS (the index links above only
17       navigate inside this page).
18
19       ·   Introduction
20
21       ·   Catalyst Basics
22
23       ·   Basic CRUD
24
25       ·   Authentication
26
27       ·   Authorization
28
29       ·   Debugging
30
31       ·   Testing
32
33       ·   Advanced CRUD
34
35       ·   Appendices
36
37       A tarball of the final application is available at <http://dev.cata
38       lyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/Final_Tar‐
39       ball/MyApp.tgz>.
40

Detailed Table of Contents

42       Part 1: Introduction
43
44       ·   VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
45
46       ·   CATALYST INSTALLATION
47
48       ·   DATABASES
49
50       ·   WHERE TO GET WORKING CODE
51
52       Part 2: Catalyst Basics
53
54       ·   CREATE A CATALYST PROJECT
55
56       ·   CREATE A SQLITE DATABASE
57
58       ·   EDIT THE LIST OF CATALYST PLUGINS
59
60       ·   DATABASE ACCESS WITH DBIx::Class
61
62           ·   Create a DBIC Schema File
63
64           ·   Create the DBIC ``Result Source'' Files
65
66           ·   Use Catalyst::Model::DBIC::Schema to Load the Model Class
67
68       ·   CREATE A CATALYST CONTROLLER
69
70       ·   CATALYST VIEWS
71
72           ·   Create a Catalyst View Using TTSite
73
74           ·   Using RenderView for the Default View
75
76           ·   Globally Customize Every View
77
78           ·   Create a TT Template Page
79
80       ·   RUN THE APPLICATION
81
82       ·   USING THE DEFAULT TEMPLATE NAME
83
84       Part 3: Basic CRUD
85
86       ·   FORMLESS SUBMISSION
87
88           ·   Include a Create Action in the Books Controller
89
90           ·   Include a Template for the url_create Action:
91
92           ·   Try the url_create Feature
93
94       ·   MANUALLY BUILDING A CREATE FORM
95
96           ·   Add a Method to Display the Form
97
98           ·   Add a Template for the Form
99
100           ·   Add Method to Process Form Values and Update Database
101
102           ·   Test Out the Form
103
104       ·   A SIMPLE DELETE FEATURE
105
106           ·   Include a Delete Link in the List
107
108           ·   Add a Delete Action to the Controller
109
110           ·   Try the Delete Feature
111
112       Part 4: Authentication
113
114       ·   BASIC AUTHENTICATION
115
116           ·   Add Users and Roles to the Database
117
118           ·   Add User and Role Information to DBIC Schema
119
120           ·   Create New ``Result Source Objects''
121
122           ·   Sanity-Check Reload of Development Server
123
124           ·   Include Authentication and Session Plugins
125
126           ·   Configure Authentication
127
128           ·   Add Login and Logout Controllers
129
130           ·   Add a Login Form TT Template Page
131
132           ·   Add Valid User Check
133
134           ·   Displaying Content Only to Authenticated Users
135
136           ·   Try Out Authentication
137
138       ·   USING PASSWORD HASHES
139
140           ·   Get a SHA-1 Hash for the Password
141
142           ·   Switch to SHA-1 Password Hashes in the Database
143
144           ·   Enable SHA-1 Hash Passwords in Catalyst::Plugin::Authentica‐
145               tion::Store::DBIC
146
147           ·   Try Out the Hashed Passwords
148
149       Part 5: Authorization
150
151       ·   BASIC AUTHORIZATION
152
153           ·   Update Plugins to Include Support for Authorization
154
155           ·   Add Config Information for Authorization
156
157           ·   Add Role-Specific Logic to the ``Book List'' Template
158
159           ·   Limit Books::add to admin Users
160
161           ·   Try Out Authentication And Authorization
162
163       ·   ENABLE ACL-BASED AUTHORIZATION
164
165           ·   Add the Catalyst::Plugin::Authorization::ACL Plugin
166
167           ·   Add ACL Rules to the Application Class
168
169           ·   Add a Method to Handle Access Violations
170
171       Part 6: Debugging
172
173       ·   LOG STATEMENTS
174
175       ·   RUNNING CATALYST UNDER THE PERL DEBUGGER
176
177       ·   DEBUGGING MODULES FROM CPAN
178
179       Part 7: Testing
180
181       ·   RUNNING THE "CANNED" CATALYST TESTS
182
183       ·   RUNNING A SINGLE TEST
184
185       ·   ADDING YOUR OWN TEST SCRIPT
186
187       ·   SUPPORTING BOTH PRODUCTION AND TEST DATABASES
188
189       Part 8: Advanced CRUD
190
191       ·   HTML::WIDGET FORM CREATION
192
193           ·   Add the HTML::Widget Plugin
194
195           ·   Add a Form Creation Helper Method
196
197           ·   Add Actions to Display and Save the Form
198
199           ·   Update the CSS
200
201           ·   Create a Template Page To Display The Form
202
203           ·   Add Links for Create and Update via HTML::Widget
204
205           ·   Test The <HTML::Widget> Create Form
206
207       ·   HTML::WIDGET VALIDATION AND FILTERING
208
209           ·   Add Constraints and Filters to the Widget Creation Method
210
211           ·   Rebuild the Form Submission Method to Include Validation
212
213           ·   Try Out the Form
214
215       ·   Enable DBIx::Class::HTMLWidget Support
216
217           ·   Add DBIx::Class::HTMLWidget to DBIC Model
218
219           ·   Use populate_from_widget in hw_create_do
220
221       Part 9: Appendices
222
223       ·   APPENDIX 1: CUT AND PASTE FOR POD-BASED EXAMPLES
224
225           ·   "Un-indenting" with Vi/Vim
226
227           ·   "Un-indenting" with Emacs
228
229       ·   APPENDIX 2: USING MYSQL AND POSTGRESQL
230
231           ·   MySQL
232
233           ·   PostgreSQL
234
235       ·   APPENDIX 3: IMPROVED HASHING SCRIPT
236

THANKS

238       This tutorial would not have been possible without the input of many
239       different people in the Catalyst community.  In particular, the primary
240       author would like to thank:
241
242       ·   Sebastian Riedel for founding the Catalyst project.
243
244       ·   The members of the Catalyst Core Team for their tireless efforts to
245           advance the Catalyst project.  Although all of the Core Team mem‐
246           bers have played a key role in this tutorial, it would have never
247           been possible without the critical contributions of: Matt Trout,
248           for his unfathomable knowledge of all things Perl and Catalyst (and
249           his willingness to answer lots of my questions); Jesse Sheidlower,
250           for his incredible skill with the written word and dedication to
251           improving the Catalyst documentation; and Yuval Kogman, for his
252           work on the Catalyst "Auth & Authz" plugins (the original focus of
253           the tutorial) and other key Catalyst modules.
254
255       ·   Other Catalyst documentation folks like Kieren Diment, Gavin Henry,
256           and Jess Robinson (including their work on the original Catalyst
257           tutorial).
258
259       ·   Everyone on #catalyst and #catalyst-dev.
260
261       ·   People who have emailed me with corrections and suggestions on the
262           tutorial.  As of the most recent release, this include: Florian
263           Ragwitz, Mauro Andreolini, Jim Howard, Giovanni Gigante, William
264           Moreno, Bryan Roach, Ashley Berlin, David Kamholz, Kevin Old, Hen‐
265           ning Sprang, Jeremy Jones, David Kurtz, and Ingo Wichmann.
266

AUTHOR

268       Kennedy Clark, "hkclark@gmail.com"
269
270       Please report any errors, issues or suggestions to the author.  The
271       most recent version of the Catalyst Tutorial can be found at
272       <http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Man
273       ual/lib/Catalyst/Manual/Tutorial/>.
274
275       Copyright 2006, Kennedy Clark, under Creative Commons License
276       (<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
277
278
279
280perl v5.8.8                       2007-02-28     Catalyst::Manual::Tutorial(3)
Impressum