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