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