Updates based on suggestion from David Kurtz.
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Manual / Tutorial.pod
CommitLineData
83cea649 1=head1 NAME
2
4d583dd8 3Catalyst::Manual::Tutorial - Catalyst Tutorial: Overview
4
83cea649 5=head1 DESCRIPTION
6
64ccd8a8 7The Catalyst framework is a flexible and comprehensive environment for
8quickly building high-functionality web applications. This tutorial is
653f4595 9designed to provide a rapid introduction to its basics and its most
10commonly used features while focusing on real-world best practices.
4d583dd8 11
653f4595 12The tutorial is divided into the following sections:
4d583dd8 13
61cc30ea 14B<NOTE:> CLICK THESE LINKS TO JUMP TO CHAPTERS (the index links above
15only navigate inside this page).
16
4d583dd8 17=over 4
18
19=item *
20
653f4595 21L<Introduction|Catalyst::Manual::Tutorial::Intro>
4d583dd8 22
23=item *
24
653f4595 25L<Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
4d583dd8 26
27=item *
28
653f4595 29L<Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
4d583dd8 30
31=item *
32
653f4595 33L<Authentication|Catalyst::Manual::Tutorial::Authentication>
4d583dd8 34
35=item *
36
653f4595 37L<Authorization|Catalyst::Manual::Tutorial::Authorization>
4d583dd8 38
39=item *
40
61cc30ea 41L<Debugging|Catalyst::Manual::Tutorial::Debugging>
42
43=item *
44
653f4595 45L<Testing|Catalyst::Manual::Tutorial::Testing>
4d583dd8 46
47=item *
48
653f4595 49L<Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
4d583dd8 50
51=item *
52
653f4595 53L<Appendices|Catalyst::Manual::Tutorial::Appendices>
4d583dd8 54
55=back
56
64ccd8a8 57A tarball of the final application is available at
dadc4d4f 58L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/Final_Tarball/MyApp.tgz>.
59
4d583dd8 60
d88df151 61=head1 Detailed Table of Contents
4d583dd8 62
61cc30ea 63=head2 L<Part 1: Introduction|Catalyst::Manual::Tutorial::Intro>
4d583dd8 64
65=over 4
66
67=item *
68
69VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
70
71=item *
72
73CATALYST INSTALLATION
74
75=item *
76
77DATABASES
78
79=item *
80
81WHERE TO GET WORKING CODE
82
83=back
84
85
61cc30ea 86=head2 L<Part 2: Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
4d583dd8 87
88=over 4
89
90=item *
91
92CREATE A CATALYST PROJECT
93
94=item *
95
96CREATE A SQLITE DATABASE
97
98=item *
99
100EDIT THE LIST OF CATALYST PLUGINS
101
102=item *
103
104DATABASE ACCESS WITH DBIx::Class
105
642d4547 106
107=over 4
108
4d583dd8 109=item *
110
111Create a DBIC Schema File
112
113=item *
114
115Create the DBIC ``Result Source'' Files
116
117=item *
118
653f4595 119Use Catalyst::Model::DBIC::Schema to Load the Model Class
4d583dd8 120
642d4547 121=back
122
123
124=item *
4d583dd8 125
126CREATE A CATALYST CONTROLLER
127
128=item *
129
130CATALYST VIEWS
131
642d4547 132
4d583dd8 133=over 4
134
135=item *
136
653f4595 137Create a Catalyst View Using TTSite
4d583dd8 138
139=item *
140
642d4547 141Using RenderView for the Default View
142
143=item *
144
4d583dd8 145Globally Customize Every View
146
147=item *
148
149Create a TT Template Page
150
151=back
152
642d4547 153
4d583dd8 154=item *
155
156RUN THE APPLICATION
157
158=back
159
61cc30ea 160=head2 L<Part 3: Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
4d583dd8 161
162=over 4
163
164=item *
165
166FORMLESS SUBMISSION
167
168=over 4
169
170=item *
171
172Include a Create Action in the Books Controller
173
174=item *
175
176Include a Template for the url_create Action:
177
178=item *
179
180Try the url_create Feature
181
182=back
183
184=item *
185
186MANUALLY BUILDING A CREATE FORM
187
188=over 4
189
190=item *
191
653f4595 192Add a Method to Display the Form
4d583dd8 193
194=item *
195
196Add a Template for the Form
197
198=item *
199
200Add Method to Process Form Values and Update Database
201
202=item *
203
653f4595 204Test Out the Form
4d583dd8 205
206=back
207
208=item *
209
210A SIMPLE DELETE FEATURE
211
212=over 4
213
214=item *
215
216Include a Delete Link in the List
217
218=item *
219
220Add a Delete Action to the Controller
221
222=item *
223
224Try the Delete Feature
225
226=back
227
228=back
229
61cc30ea 230=head2 L<Part 4: Authentication|Catalyst::Manual::Tutorial::Authentication>
4d583dd8 231
232=over 4
233
234=item *
235
236BASIC AUTHENTICATION
237
238=over 4
239
240=item *
241
242Add Users and Roles to the Database
243
244=item *
245
64ccd8a8 246Add User and Role Information to DBIC Schema
4d583dd8 247
248=item *
249
250Create New ``Result Source Objects''
251
252=item *
253
254Sanity-Check Reload of Development Server
255
256=item *
257
258Include Authentication and Session Plugins
259
260=item *
261
262Configure Authentication
263
264=item *
265
266Add Login and Logout Controllers
267
268=item *
269
270Add a Login Form TT Template Page
271
272=item *
273
274Add Valid User Check
275
276=item *
277
278Displaying Content Only to Authenticated Users
279
280=item *
281
282Try Out Authentication
283
284=back
285
286=item *
287
288USING PASSWORD HASHES
289
290=over 4
291
292=item *
293
294Get a SHA-1 Hash for the Password
295
296=item *
297
298Switch to SHA-1 Password Hashes in the Database
299
300=item *
301
302Enable SHA-1 Hash Passwords in Catalyst::Plugin::Authentication::Store::DBIC
303
304=item *
305
306Try Out the Hashed Passwords
307
308=back
309
310=back
311
61cc30ea 312=head2 L<Part 5: Authorization|Catalyst::Manual::Tutorial::Authorization>
4d583dd8 313
314=over 4
315
316=item *
83cea649 317
4d583dd8 318BASIC AUTHORIZATION
83cea649 319
4d583dd8 320=over 4
83cea649 321
4d583dd8 322=item *
83cea649 323
653f4595 324Update Plugins to Include Support for Authorization
83cea649 325
4d583dd8 326=item *
83cea649 327
4d583dd8 328Add Config Information for Authorization
83cea649 329
4d583dd8 330=item *
83cea649 331
4d583dd8 332Add Role-Specific Logic to the ``Book List'' Template
b248fa4a 333
4d583dd8 334=item *
83cea649 335
4d583dd8 336Limit Books::add to admin Users
83cea649 337
4d583dd8 338=item *
83cea649 339
4d583dd8 340Try Out Authentication And Authorization
83cea649 341
4d583dd8 342=back
b33ed88c 343
4d583dd8 344=item *
b248fa4a 345
4d583dd8 346ENABLE ACL-BASED AUTHORIZATION
b33ed88c 347
4d583dd8 348=over 4
b460ad78 349
4d583dd8 350=item *
83cea649 351
4d583dd8 352Add the Catalyst::Plugin::Authorization::ACL Plugin
b248fa4a 353
4d583dd8 354=item *
83cea649 355
4d583dd8 356Add ACL Rules to the Application Class
83cea649 357
4d583dd8 358=item *
387e4c50 359
4d583dd8 360Add a Method to Handle Access Violations
83cea649 361
4d583dd8 362=back
83cea649 363
4d583dd8 364=back
83cea649 365
61cc30ea 366=head2 L<Part 6: Debugging|Catalyst::Manual::Tutorial::Debugging>
83cea649 367
4d583dd8 368=over 4
83cea649 369
4d583dd8 370=item *
83cea649 371
4d583dd8 372LOG STATEMENTS
83cea649 373
4d583dd8 374=item *
83cea649 375
4d583dd8 376RUNNING CATALYST UNDER THE PERL DEBUGGER
83cea649 377
642d4547 378=item *
379
380DEBUGGING MODULES FROM CPAN
381
4d583dd8 382=back
587d5860 383
61cc30ea 384=head2 L<Part 7: Testing|Catalyst::Manual::Tutorial::Testing>
83cea649 385
4d583dd8 386=over 4
83cea649 387
4d583dd8 388=item *
8d47005f 389
4d583dd8 390RUNNING THE "CANNED" CATALYST TESTS
8d47005f 391
4d583dd8 392=item *
8d47005f 393
4d583dd8 394RUNNING A SINGLE TEST
c425bfeb 395
4d583dd8 396=item *
c425bfeb 397
4d583dd8 398ADDING YOUR OWN TEST SCRIPT
8d47005f 399
4d583dd8 400=item *
8d47005f 401
4d583dd8 402SUPPORTING BOTH PRODUCTION AND TEST DATABASES
de6fb80a 403
4d583dd8 404=back
8d47005f 405
61cc30ea 406=head2 L<Part 8: Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
8d47005f 407
4d583dd8 408=over 4
8d47005f 409
4d583dd8 410=item *
8d47005f 411
4d583dd8 412HTML::WIDGET FORM CREATION
de6fb80a 413
4d583dd8 414=over 4
8d47005f 415
4d583dd8 416=item *
8d47005f 417
4d583dd8 418Add the HTML::Widget Plugin
8d47005f 419
4d583dd8 420=item *
8d47005f 421
4d583dd8 422Add a Form Creation Helper Method
8d47005f 423
4d583dd8 424=item *
8d47005f 425
4d583dd8 426Add Actions to Display and Save the Form
8d47005f 427
4d583dd8 428=item *
b460ad78 429
4d583dd8 430Update the CSS
b460ad78 431
4d583dd8 432=item *
b460ad78 433
4d583dd8 434Create a Template Page To Display The Form
b460ad78 435
4d583dd8 436=item *
b460ad78 437
4d583dd8 438Add Links for Create and Update via HTML::Widget
b460ad78 439
4d583dd8 440=item *
b460ad78 441
4d583dd8 442Test The <HTML::Widget> Create Form
b460ad78 443
4d583dd8 444=back
b460ad78 445
4d583dd8 446=item *
b460ad78 447
4d583dd8 448HTML::WIDGET VALIDATION AND FILTERING
b460ad78 449
4d583dd8 450=over 4
b460ad78 451
4d583dd8 452=item *
83cea649 453
4d583dd8 454Add Constraints and Filters to the Widget Creation Method
8d47005f 455
4d583dd8 456=item *
8d47005f 457
4d583dd8 458Rebuild the Form Submission Method to Include Validation
8d47005f 459
4d583dd8 460=item *
8d47005f 461
4d583dd8 462Try Out the Form
8d47005f 463
4d583dd8 464=back
8d47005f 465
4d583dd8 466=item *
8d47005f 467
4d583dd8 468Enable DBIx::Class::HTMLWidget Support
8d47005f 469
4d583dd8 470=over 4
8d47005f 471
4d583dd8 472=item *
83cea649 473
4d583dd8 474Add DBIx::Class::HTMLWidget to DBIC Model
b460ad78 475
4d583dd8 476=item *
b460ad78 477
4d583dd8 478Use populate_from_widget in hw_create_do
b460ad78 479
4d583dd8 480=back
b460ad78 481
4d583dd8 482=back
b460ad78 483
61cc30ea 484=head2 L<Part 9: Appendices|Catalyst::Manual::Tutorial::Appendices>
b460ad78 485
4d583dd8 486=over 4
b460ad78 487
4d583dd8 488=item *
8d47005f 489
4d583dd8 490APPENDIX 1: CUT AND PASTE FOR POD-BASED EXAMPLES
8d47005f 491
4d583dd8 492=over 4
8d47005f 493
4d583dd8 494=item *
8d47005f 495
4d583dd8 496"Un-indenting" with Vi/Vim
8d47005f 497
4d583dd8 498=item *
8d47005f 499
4d583dd8 500"Un-indenting" with Emacs
8d47005f 501
4d583dd8 502=back
8d47005f 503
4d583dd8 504=item *
8d47005f 505
4d583dd8 506APPENDIX 2: USING MYSQL AND POSTGRESQL
8d47005f 507
4d583dd8 508=over 4
8d47005f 509
4d583dd8 510=item *
b460ad78 511
4d583dd8 512MySQL
8d47005f 513
4d583dd8 514=item *
8d47005f 515
4d583dd8 516PostgreSQL
8d47005f 517
4d583dd8 518=back
b460ad78 519
642d4547 520=item *
521
522APPENDIX 3: IMPROVED HASHING SCRIPT
523
4d583dd8 524=back
83cea649 525
642d4547 526
527=head1 THANKS
528
529This tutorial would not have been possible without the input of many
530different people in the Catalyst community. In particular, the
531primary author would like to thank:
532
533=over 4
534
535=item *
536
537Sebastian Riedel for founding the Catalyst project.
538
539=item *
540
f4260a7a 541The members of the Catalyst Core Team for their tireless efforts to
542advance the Catalyst project. Although all of the Core Team members
543have played a key role in this tutorial, it would have never been
544possible without the critical contributions of: Matt Trout, for his
545unfathomable knowledge of all things Perl and Catalyst (and his
546willingness to answer lots of my questions); Jesse Sheidlower, for his
547incredible skill with the written word and dedication to improving the
548Catalyst documentation; and Yuval Kogman, for his work on the Catalyst
549"Auth & Authz" plugins (the original focus of the tutorial) and other
642d4547 550key Catalyst modules.
551
552=item *
553
642d4547 554Other Catalyst documentation folks like Kieren Diment, Gavin Henry,
555and Jess Robinson (including their work on the original Catalyst
556tutorial).
557
558=item *
559
be9712b1 560Everyone on #catalyst and #catalyst-dev.
561
562=item *
563
642d4547 564People who have emailed me with corrections and suggestions on the
565tutorial. As of the most recent release, this include: Florian Ragwitz,
c9b77c06 566Mauro Andreolini, Jim Howard, Giovanni Gigante, William Moreno,
4f4dac1f 567Bryan Roach, Ashley Berlin, David Kamholz, Kevin Old, Henning Sprang,
d0afb3a9 568Jeremy Jones, and David Kurtz.
642d4547 569
570=back
571
572
573
574=head1 AUTHOR
575
576Kennedy Clark, C<hkclark@gmail.com>
577
578Please report any errors, issues or suggestions to the author. The
7d310f12 579most recent version of the Catalyst Tutorial can be found at
642d4547 580L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
581
582Copyright 2006, Kennedy Clark, under Creative Commons License
583(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).