Commit | Line | Data |
---|---|---|
83cea649 | 1 | =head1 NAME |
2 | ||
4d583dd8 | 3 | Catalyst::Manual::Tutorial - Catalyst Tutorial: Overview |
4 | ||
5 | ||
83cea649 | 6 | |
7 | =head1 DESCRIPTION | |
8 | ||
64ccd8a8 | 9 | The Catalyst framework is a flexible and comprehensive environment for |
10 | quickly building high-functionality web applications. This tutorial is | |
11 | design to provide a rapid introduction to its basics and most commonly | |
12 | used features while focusing on real-world best practices. | |
4d583dd8 | 13 | |
14 | The tutorial is broken down into the following sections: | |
15 | ||
16 | =over 4 | |
17 | ||
18 | =item * | |
19 | ||
64ccd8a8 | 20 | L<Introduction|Catalyst::Manual::Tutorial_Intro> |
4d583dd8 | 21 | |
22 | =item * | |
23 | ||
64ccd8a8 | 24 | L<Catalyst Basics|Catalyst::Manual::Tutorial_CatalystBasics> |
4d583dd8 | 25 | |
26 | =item * | |
27 | ||
64ccd8a8 | 28 | L<CRUD|Catalyst::Manual::Tutorial_BasicCRUD> |
4d583dd8 | 29 | |
30 | =item * | |
31 | ||
64ccd8a8 | 32 | L<Authentication|Catalyst::Manual::Tutorial_Authentication> |
4d583dd8 | 33 | |
34 | =item * | |
35 | ||
64ccd8a8 | 36 | L<Authorization|Catalyst::Manual::Tutorial_Authorization> |
4d583dd8 | 37 | |
38 | =item * | |
39 | ||
64ccd8a8 | 40 | L<Debugging|Catalyst::Manual::Tutorial_Debugging> |
4d583dd8 | 41 | |
42 | =item * | |
43 | ||
64ccd8a8 | 44 | L<Testing|Catalyst::Manual::Tutorial_Testing> |
4d583dd8 | 45 | |
46 | =item * | |
47 | ||
64ccd8a8 | 48 | L<CRUD|Catalyst::Manual::Tutorial_AdvancedCRUD> |
4d583dd8 | 49 | |
50 | =item * | |
51 | ||
64ccd8a8 | 52 | L<Appendicies|Catalyst::Manual::Tutorial_Appendicies> |
4d583dd8 | 53 | |
54 | =back | |
55 | ||
56 | ||
64ccd8a8 | 57 | Full source code is available for each section via the main Catalyst |
58 | Subversion repository at | |
59 | L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/>. See the | |
60 | end of each section for the specifics on retrieving code for that | |
61 | section. | |
4d583dd8 | 62 | |
64ccd8a8 | 63 | A tarball of the final application is available at |
64 | C<to_be_compled_in_final_version>. | |
4d583dd8 | 65 | |
66 | =head1 Detailed Table Of Contents | |
67 | ||
68 | =head2 Part 1: Introduction | |
69 | ||
70 | =over 4 | |
71 | ||
72 | =item * | |
73 | ||
74 | VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL | |
75 | ||
76 | =item * | |
77 | ||
78 | CATALYST INSTALLATION | |
79 | ||
80 | =item * | |
81 | ||
82 | DATABASES | |
83 | ||
84 | =item * | |
85 | ||
86 | WHERE TO GET WORKING CODE | |
87 | ||
88 | =back | |
89 | ||
90 | ||
4d583dd8 | 91 | =head2 Part 2: Catalyst Application Development Basics |
92 | ||
93 | =over 4 | |
94 | ||
95 | =item * | |
96 | ||
97 | CREATE A CATALYST PROJECT | |
98 | ||
99 | =item * | |
100 | ||
101 | CREATE A SQLITE DATABASE | |
102 | ||
103 | =item * | |
104 | ||
105 | EDIT THE LIST OF CATALYST PLUGINS | |
106 | ||
107 | =item * | |
108 | ||
109 | DATABASE ACCESS WITH DBIx::Class | |
110 | ||
111 | =over 4 | |
112 | ||
113 | =item * | |
114 | ||
115 | Create a DBIC Schema File | |
116 | ||
117 | =item * | |
118 | ||
119 | Create the DBIC ``Result Source'' Files | |
120 | ||
121 | =item * | |
122 | ||
123 | Use Catalyst::Model::DBIC::Schema To Load The Model Class | |
124 | ||
125 | =back | |
126 | ||
127 | =item * | |
128 | ||
129 | CREATE A CATALYST CONTROLLER | |
130 | ||
131 | =item * | |
132 | ||
133 | CATALYST VIEWS | |
134 | ||
135 | =over 4 | |
136 | ||
137 | =item * | |
138 | ||
139 | Create a Catalyst View Using TTSITE | |
140 | ||
141 | =item * | |
142 | ||
143 | Globally Customize Every View | |
144 | ||
145 | =item * | |
146 | ||
147 | Create a TT Template Page | |
148 | ||
149 | =back | |
150 | ||
151 | =item * | |
152 | ||
153 | RUN THE APPLICATION | |
154 | ||
155 | =back | |
156 | ||
157 | ||
4d583dd8 | 158 | =head2 Part 3: Basic CRUD |
159 | ||
160 | =over 4 | |
161 | ||
162 | =item * | |
163 | ||
164 | FORMLESS SUBMISSION | |
165 | ||
166 | =over 4 | |
167 | ||
168 | =item * | |
169 | ||
170 | Include a Create Action in the Books Controller | |
171 | ||
172 | =item * | |
173 | ||
174 | Include a Template for the url_create Action: | |
175 | ||
176 | =item * | |
177 | ||
178 | Try the url_create Feature | |
179 | ||
180 | =back | |
181 | ||
182 | =item * | |
183 | ||
184 | MANUALLY BUILDING A CREATE FORM | |
185 | ||
186 | =over 4 | |
187 | ||
188 | =item * | |
189 | ||
190 | Add Method to Display The Form | |
191 | ||
192 | =item * | |
193 | ||
194 | Add a Template for the Form | |
195 | ||
196 | =item * | |
197 | ||
198 | Add Method to Process Form Values and Update Database | |
199 | ||
200 | =item * | |
201 | ||
202 | Test Out The Form | |
203 | ||
204 | =back | |
205 | ||
206 | =item * | |
207 | ||
208 | A SIMPLE DELETE FEATURE | |
209 | ||
210 | =over 4 | |
211 | ||
212 | =item * | |
213 | ||
214 | Include a Delete Link in the List | |
215 | ||
216 | =item * | |
217 | ||
218 | Add a Delete Action to the Controller | |
219 | ||
220 | =item * | |
221 | ||
222 | Try the Delete Feature | |
223 | ||
224 | =back | |
225 | ||
226 | =back | |
227 | ||
228 | ||
4d583dd8 | 229 | =head2 Part 4: Authentication |
230 | ||
231 | =over 4 | |
232 | ||
233 | =item * | |
234 | ||
235 | BASIC AUTHENTICATION | |
236 | ||
237 | =over 4 | |
238 | ||
239 | =item * | |
240 | ||
241 | Add Users and Roles to the Database | |
242 | ||
243 | =item * | |
244 | ||
64ccd8a8 | 245 | Add User and Role Information to DBIC Schema |
4d583dd8 | 246 | |
247 | =item * | |
248 | ||
249 | Create New ``Result Source Objects'' | |
250 | ||
251 | =item * | |
252 | ||
253 | Sanity-Check Reload of Development Server | |
254 | ||
255 | =item * | |
256 | ||
257 | Include Authentication and Session Plugins | |
258 | ||
259 | =item * | |
260 | ||
261 | Configure Authentication | |
262 | ||
263 | =item * | |
264 | ||
265 | Add Login and Logout Controllers | |
266 | ||
267 | =item * | |
268 | ||
269 | Add a Login Form TT Template Page | |
270 | ||
271 | =item * | |
272 | ||
273 | Add Valid User Check | |
274 | ||
275 | =item * | |
276 | ||
277 | Displaying Content Only to Authenticated Users | |
278 | ||
279 | =item * | |
280 | ||
281 | Try Out Authentication | |
282 | ||
283 | =back | |
284 | ||
285 | =item * | |
286 | ||
287 | USING PASSWORD HASHES | |
288 | ||
289 | =over 4 | |
290 | ||
291 | =item * | |
292 | ||
293 | Get a SHA-1 Hash for the Password | |
294 | ||
295 | =item * | |
296 | ||
297 | Switch to SHA-1 Password Hashes in the Database | |
298 | ||
299 | =item * | |
300 | ||
301 | Enable SHA-1 Hash Passwords in Catalyst::Plugin::Authentication::Store::DBIC | |
302 | ||
303 | =item * | |
304 | ||
305 | Try Out the Hashed Passwords | |
306 | ||
307 | =back | |
308 | ||
309 | =back | |
310 | ||
311 | ||
4d583dd8 | 312 | =head2 Part 5: Authorization |
313 | ||
314 | =over 4 | |
315 | ||
316 | =item * | |
83cea649 | 317 | |
4d583dd8 | 318 | BASIC AUTHORIZATION |
83cea649 | 319 | |
4d583dd8 | 320 | =over 4 |
83cea649 | 321 | |
4d583dd8 | 322 | =item * |
83cea649 | 323 | |
64ccd8a8 | 324 | Update Plugins to Include Support for Authorization |
83cea649 | 325 | |
4d583dd8 | 326 | =item * |
83cea649 | 327 | |
4d583dd8 | 328 | Add Config Information for Authorization |
83cea649 | 329 | |
4d583dd8 | 330 | =item * |
83cea649 | 331 | |
4d583dd8 | 332 | Add Role-Specific Logic to the ``Book List'' Template |
b248fa4a | 333 | |
4d583dd8 | 334 | =item * |
83cea649 | 335 | |
4d583dd8 | 336 | Limit Books::add to admin Users |
83cea649 | 337 | |
4d583dd8 | 338 | =item * |
83cea649 | 339 | |
4d583dd8 | 340 | Try Out Authentication And Authorization |
83cea649 | 341 | |
4d583dd8 | 342 | =back |
b33ed88c | 343 | |
4d583dd8 | 344 | =item * |
b248fa4a | 345 | |
4d583dd8 | 346 | ENABLE ACL-BASED AUTHORIZATION |
b33ed88c | 347 | |
4d583dd8 | 348 | =over 4 |
b460ad78 | 349 | |
4d583dd8 | 350 | =item * |
83cea649 | 351 | |
4d583dd8 | 352 | Add the Catalyst::Plugin::Authorization::ACL Plugin |
b248fa4a | 353 | |
4d583dd8 | 354 | =item * |
83cea649 | 355 | |
4d583dd8 | 356 | Add ACL Rules to the Application Class |
83cea649 | 357 | |
4d583dd8 | 358 | =item * |
387e4c50 | 359 | |
4d583dd8 | 360 | Add a Method to Handle Access Violations |
83cea649 | 361 | |
4d583dd8 | 362 | =back |
83cea649 | 363 | |
4d583dd8 | 364 | =back |
83cea649 | 365 | |
83cea649 | 366 | |
4d583dd8 | 367 | =head2 Part 6: Debugging |
83cea649 | 368 | |
4d583dd8 | 369 | =over 4 |
83cea649 | 370 | |
4d583dd8 | 371 | =item * |
83cea649 | 372 | |
4d583dd8 | 373 | LOG STATEMENTS |
83cea649 | 374 | |
4d583dd8 | 375 | =item * |
83cea649 | 376 | |
4d583dd8 | 377 | RUNNING CATALYST UNDER THE PERL DEBUGGER |
83cea649 | 378 | |
4d583dd8 | 379 | =back |
587d5860 | 380 | |
587d5860 | 381 | |
4d583dd8 | 382 | =head2 Part 7: Testing |
83cea649 | 383 | |
4d583dd8 | 384 | =over 4 |
83cea649 | 385 | |
4d583dd8 | 386 | =item * |
8d47005f | 387 | |
4d583dd8 | 388 | RUNNING THE "CANNED" CATALYST TESTS |
8d47005f | 389 | |
4d583dd8 | 390 | =item * |
8d47005f | 391 | |
4d583dd8 | 392 | RUNNING A SINGLE TEST |
c425bfeb | 393 | |
4d583dd8 | 394 | =item * |
c425bfeb | 395 | |
4d583dd8 | 396 | ADDING YOUR OWN TEST SCRIPT |
8d47005f | 397 | |
4d583dd8 | 398 | =item * |
8d47005f | 399 | |
4d583dd8 | 400 | SUPPORTING BOTH PRODUCTION AND TEST DATABASES |
de6fb80a | 401 | |
4d583dd8 | 402 | =back |
8d47005f | 403 | |
8d47005f | 404 | |
4d583dd8 | 405 | =head2 Part 8: Advanced CRUD |
8d47005f | 406 | |
4d583dd8 | 407 | =over 4 |
8d47005f | 408 | |
4d583dd8 | 409 | =item * |
8d47005f | 410 | |
4d583dd8 | 411 | HTML::WIDGET FORM CREATION |
de6fb80a | 412 | |
4d583dd8 | 413 | =over 4 |
8d47005f | 414 | |
4d583dd8 | 415 | =item * |
8d47005f | 416 | |
4d583dd8 | 417 | Add the HTML::Widget Plugin |
8d47005f | 418 | |
4d583dd8 | 419 | =item * |
8d47005f | 420 | |
4d583dd8 | 421 | Add a Form Creation Helper Method |
8d47005f | 422 | |
4d583dd8 | 423 | =item * |
8d47005f | 424 | |
4d583dd8 | 425 | Add Actions to Display and Save the Form |
8d47005f | 426 | |
4d583dd8 | 427 | =item * |
b460ad78 | 428 | |
4d583dd8 | 429 | Update the CSS |
b460ad78 | 430 | |
4d583dd8 | 431 | =item * |
b460ad78 | 432 | |
4d583dd8 | 433 | Create a Template Page To Display The Form |
b460ad78 | 434 | |
4d583dd8 | 435 | =item * |
b460ad78 | 436 | |
4d583dd8 | 437 | Add Links for Create and Update via HTML::Widget |
b460ad78 | 438 | |
4d583dd8 | 439 | =item * |
b460ad78 | 440 | |
4d583dd8 | 441 | Test The <HTML::Widget> Create Form |
b460ad78 | 442 | |
4d583dd8 | 443 | =back |
b460ad78 | 444 | |
4d583dd8 | 445 | =item * |
b460ad78 | 446 | |
4d583dd8 | 447 | HTML::WIDGET VALIDATION AND FILTERING |
b460ad78 | 448 | |
4d583dd8 | 449 | =over 4 |
b460ad78 | 450 | |
4d583dd8 | 451 | =item * |
83cea649 | 452 | |
4d583dd8 | 453 | Add Constraints and Filters to the Widget Creation Method |
8d47005f | 454 | |
4d583dd8 | 455 | =item * |
8d47005f | 456 | |
4d583dd8 | 457 | Rebuild the Form Submission Method to Include Validation |
8d47005f | 458 | |
4d583dd8 | 459 | =item * |
8d47005f | 460 | |
4d583dd8 | 461 | Try Out the Form |
8d47005f | 462 | |
4d583dd8 | 463 | =back |
8d47005f | 464 | |
4d583dd8 | 465 | =item * |
8d47005f | 466 | |
4d583dd8 | 467 | Enable DBIx::Class::HTMLWidget Support |
8d47005f | 468 | |
4d583dd8 | 469 | =over 4 |
8d47005f | 470 | |
4d583dd8 | 471 | =item * |
83cea649 | 472 | |
4d583dd8 | 473 | Add DBIx::Class::HTMLWidget to DBIC Model |
b460ad78 | 474 | |
4d583dd8 | 475 | =item * |
b460ad78 | 476 | |
4d583dd8 | 477 | Use populate_from_widget in hw_create_do |
b460ad78 | 478 | |
4d583dd8 | 479 | =back |
b460ad78 | 480 | |
4d583dd8 | 481 | =back |
b460ad78 | 482 | |
b460ad78 | 483 | |
4d583dd8 | 484 | =head2 Part 9: Appendices |
b460ad78 | 485 | |
4d583dd8 | 486 | =over 4 |
b460ad78 | 487 | |
4d583dd8 | 488 | =item * |
8d47005f | 489 | |
4d583dd8 | 490 | APPENDIX 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 | 506 | APPENDIX 2: USING MYSQL AND POSTGRESQL |
8d47005f | 507 | |
4d583dd8 | 508 | =over 4 |
8d47005f | 509 | |
4d583dd8 | 510 | =item * |
b460ad78 | 511 | |
4d583dd8 | 512 | MySQL |
8d47005f | 513 | |
4d583dd8 | 514 | =item * |
8d47005f | 515 | |
4d583dd8 | 516 | PostgreSQL |
8d47005f | 517 | |
4d583dd8 | 518 | =back |
b460ad78 | 519 | |
4d583dd8 | 520 | =back |
83cea649 | 521 |