96caa8ae3451b52d87cb4be3601f4d9e8ec76827
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Tutorial.pod
1 =head1 NAME
2
3 Catalyst::Manual::Tutorial - Catalyst Tutorial: Overview
4
5 =head1 DESCRIPTION
6
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.
11
12 The tutorial is divided into the following sections:
13
14 B<NOTE: CLICK THESE LINKS TO JUMP TO CHAPTERS> (the index links above
15 only navigate inside this page).
16
17 =over 4
18
19 =item 1
20
21 L<Introduction|Catalyst::Manual::Tutorial::Intro>
22
23 =item 2
24
25 L<Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
26
27 =item 3
28
29 L<More Catalyst Basics|Catalyst::Manual::Tutorial::MoreCatalystBasics>
30
31 =item 4
32
33 L<Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
34
35 =item 5
36
37 L<Authentication|Catalyst::Manual::Tutorial::Authentication>
38
39 =item 6
40
41 L<Authorization|Catalyst::Manual::Tutorial::Authorization>
42
43 =item 7
44
45 L<Debugging|Catalyst::Manual::Tutorial::Debugging>
46
47 =item 8
48
49 L<Testing|Catalyst::Manual::Tutorial::Testing>
50
51 =item 9
52
53 L<Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
54
55 =item 10
56
57 L<Appendices|Catalyst::Manual::Tutorial::Appendices>
58
59 =back
60
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/>.
63
64
65 =head1 Detailed Table of Contents
66
67
68 =head2 L<Chapter 1: Intro|Catalyst::Manual::Tutorial::Intro>
69
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.
72
73 =over 4
74
75 =item *
76
77 VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
78
79 =item *
80
81 CATALYST INSTALLATION
82
83 =item *
84
85 DATABASES
86
87 =item *
88
89 WHERE TO GET WORKING CODE
90
91 =back
92
93
94 =head2 L<Chapter 2: Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
95
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.
98
99 =over 4
100
101 =item *
102
103 CREATE A CATALYST PROJECT
104
105 =item *
106
107 HELLO WORLD
108
109 =over 4
110
111 =item *
112
113 The Simplest Way
114
115 =item *
116
117 Hello, World! Using a View and a Template
118
119 =back
120
121 =item *
122
123 CREATE A SIMPLE CONTROLLER AND AN ACTION
124
125 =back
126
127
128 =head2 L<Chapter 3: More Catalyst Basics|Catalyst::Manual::Tutorial::MoreCatalystBasics>
129
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.
132
133 =over 4
134
135 =item *
136
137 CREATE A NEW APPLICATION
138
139 =item *
140
141 EDIT THE LIST OF CATALYST PLUGINS
142
143 =item *
144
145 CREATE A CATALYST CONTROLLER
146
147 =item *
148
149 CATALYST VIEWS
150
151
152 =over 4
153
154 =item *
155
156 Create a Catalyst View Using TTSite
157
158 =item *
159
160 Globally Customize Every View
161
162 =item *
163
164 Create a TT Template Page
165
166 =back
167
168 =item *
169
170 CREATE A SQLITE DATABASE
171
172 =item *
173
174 DATABASE ACCESS WITH DBIx::Class
175
176 =over 4
177
178 =item *
179
180 Create a Dynamic DBIC Model
181
182 =back
183
184 =item *
185
186 RUN THE APPLICATION
187
188 =item *
189
190 A STATIC DATABASE MODEL WITH DBIx::Class
191
192 =over 4
193
194 =item *
195
196 Create Static DBIC Schema Files
197
198 =item *
199
200 Updating the Generated DBIC Schema Files
201
202 =back
203
204 =item *
205
206 RUN THE APPLICATION
207
208 =item *
209
210 RUNNING THE APPLICATION FROM THE COMMAND LINE
211
212 =item *
213
214 UPDATING THE VIEW
215
216 =over 4
217
218 =item *
219
220 Using RenderView for the Default View
221
222 =item *
223
224 Using The Default Template Name
225
226 =item *
227
228 Return To A Manually-Specified Template
229
230 =back
231
232 =back
233
234
235 =head2 L<Chapter 4: Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
236
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.
239
240 =over 4
241
242 =item *
243
244 FORMLESS SUBMISSION
245
246 =over 4
247
248 =item *
249
250 Include a Create Action in the Books Controller
251
252 =item *
253
254 Include a Template for the url_create Action:
255
256 =item *
257
258 Try the url_create Feature
259
260 =back
261
262 =item *
263
264 MANUALLY BUILDING A CREATE FORM
265
266 =over 4
267
268 =item *
269
270 Add a Method to Display the Form
271
272 =item *
273
274 Add a Template for the Form
275
276 =item *
277
278 Add Method to Process Form Values and Update Database
279
280 =item *
281
282 Test Out the Form
283
284 =back
285
286 =item *
287
288 A SIMPLE DELETE FEATURE
289
290 =over 4
291
292 =item *
293
294 Include a Delete Link in the List
295
296 =item *
297
298 Add a Delete Action to the Controller
299
300 =item *
301
302 Try the Delete Feature
303
304 =item *
305
306 Fixing a Dangerous URL
307
308 =item *
309
310 Try the Delete and Redirect Logic
311
312 =item *
313
314 Using uri_for to Pass Query Parameters
315
316 =item *
317
318 Try the Delete and Redirect With Query Param Logic
319
320 =back
321
322 =back
323
324
325 =head2 L<Chapter 5: Authentication|Catalyst::Manual::Tutorial::Authentication>
326
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.
329
330 =over 4
331
332 =item *
333
334 BASIC AUTHENTICATION
335
336 =over 4
337
338 =item *
339
340 Add Users and Roles to the Database
341
342 =item *
343
344 Add User and Role Information to DBIC Schema
345
346 =item *
347
348 Sanity-Check Reload of Development Server
349
350 =item *
351
352 Include Authentication and Session Plugins
353
354 =item *
355
356 Configure Authentication
357
358 =item *
359
360 Add Login and Logout Controllers
361
362 =item *
363
364 Add a Login Form TT Template Page
365
366 =item *
367
368 Add Valid User Check
369
370 =item *
371
372 Displaying Content Only to Authenticated Users
373
374 =item *
375
376 Try Out Authentication
377
378 =back
379
380 =item *
381
382 USING PASSWORD HASHES
383
384 =over 4
385
386 =item *
387
388 Get a SHA-1 Hash for the Password
389
390 =item *
391
392 Switch to SHA-1 Password Hashes in the Database
393
394 =item *
395
396 Enable SHA-1 Hash Passwords in Catalyst::Plugin::Authentication::Store::DBIC
397
398 =item *
399
400 Try Out the Hashed Passwords
401
402 =back
403
404 =item *
405
406 USING THE SESSION FOR FLASH
407
408 =over 4
409
410 =item *
411
412 Try Out Flash
413
414 =item *
415
416 Switch To Flash-To-Stash
417
418 =back
419
420 =back
421
422
423 =head2 L<Chapter 6: Authorization|Catalyst::Manual::Tutorial::Authorization>
424
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.
427
428 =over 4
429
430 =item *
431
432 BASIC AUTHORIZATION
433
434 =over 4
435
436 =item *
437
438 Update Plugins to Include Support for Authorization
439
440 =item *
441
442 Add Config Information for Authorization
443
444 =item *
445
446 Add Role-Specific Logic to the ``Book List'' Template
447
448 =item *
449
450 Limit Books::add to admin Users
451
452 =item *
453
454 Try Out Authentication And Authorization
455
456 =back
457
458 =item *
459
460 ENABLE ACL-BASED AUTHORIZATION
461
462 =over 4
463
464 =item *
465
466 Add the Catalyst::Plugin::Authorization::ACL Plugin
467
468 =item *
469
470 Add ACL Rules to the Application Class
471
472 =item *
473
474 Add a Method to Handle Access Violations
475
476 =back
477
478 =back
479
480
481 =head2 L<Chapter 7: Debugging|Catalyst::Manual::Tutorial::Debugging>
482
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.
485
486 =over 4
487
488 =item *
489
490 LOG STATEMENTS
491
492 =item *
493
494 RUNNING CATALYST UNDER THE PERL DEBUGGER
495
496 =item *
497
498 DEBUGGING MODULES FROM CPAN
499
500 =back
501
502
503 =head2 L<Chapter 8: Testing|Catalyst::Manual::Tutorial::Testing>
504
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.
507
508 =over 4
509
510 =item *
511
512 RUNNING THE "CANNED" CATALYST TESTS
513
514 =item *
515
516 RUNNING A SINGLE TEST
517
518 =item *
519
520 ADDING YOUR OWN TEST SCRIPT
521
522 =item *
523
524 SUPPORTING BOTH PRODUCTION AND TEST DATABASES
525
526 =back
527
528
529 =head2 L<Chapter 9: Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
530
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.
533
534 =over 4
535
536 =item *
537
538 ADVANCED CRUD OPTIONS
539
540 =back
541
542
543 =head2 L<Chapter 10: Appendices|Catalyst::Manual::Tutorial::Appendices>
544
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.
547
548 =over 4
549
550 =item *
551
552 APPENDIX 1: CUT AND PASTE FOR POD-BASED EXAMPLES
553
554 =over 4
555
556 =item *
557
558 "Un-indenting" with Vi/Vim
559
560 =item *
561
562 "Un-indenting" with Emacs
563
564 =back
565
566 =item *
567
568 APPENDIX 2: USING MYSQL AND POSTGRESQL
569
570 =over 4
571
572 =item *
573
574 MySQL
575
576 =item *
577
578 PostgreSQL
579
580 =back
581
582 =item *
583
584 APPENDIX 3: IMPROVED HASHING SCRIPT
585
586 =back
587
588
589 =head1 THANKS
590
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:
594
595 =over 4
596
597 =item *
598
599 Sebastian Riedel for founding the Catalyst project.
600
601 =item *
602
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.
613
614 =item *
615
616 Other Catalyst documentation folks like Kieren Diment, Gavin Henry,
617 and Jess Robinson (including their work on the original Catalyst
618 tutorial).  
619
620 =item *
621
622 Kieren Diment for his oversite of Catalyst-related documentation.
623
624 =item *
625
626 Everyone on #catalyst and #catalyst-dev.
627
628 =item *
629
630 Louis Moore (who thanks Marcello Romani and Tom Lanyon) for the
631 PostgreSQL content in the Appendix.
632
633 =item *
634
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 
643 should be here).
644
645 =back
646
647 =head1 AUTHOR
648
649 Kennedy Clark, C<hkclark@gmail.com>
650
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/>.
654
655 Copyright 2006-2008, Kennedy Clark, under Creative Commons License
656 (L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).