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