Cleaned up Tut files; no substantive changes
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Manual / Tutorial / Intro.pod
CommitLineData
4d583dd8 1=head1 NAME
2
64ccd8a8 3Catalyst::Manual::Tutorial::Intro - Catalyst Tutorial - Part 1: Introduction
4d583dd8 4
5
6
7=head1 OVERVIEW
8
9This is B<Part 1 of 9> for the Catalyst tutorial.
10
64ccd8a8 11L<Tutorial Overview|Catalyst::Manual::Tutorial>
4d583dd8 12
13=over 4
14
15=item 1
16
17B<Introduction>
18
19=item 2
20
21L<Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
22
23=item 3
24
64ccd8a8 25L<Basic CRUD|Catalyst::Manual::Tutorial_BasicCRUD>
4d583dd8 26
27=item 4
28
29L<Authentication|Catalyst::Manual::Tutorial::Authentication>
30
31=item 5
32
33L<Authorization|Catalyst::Manual::Tutorial::Authorization>
34
35=item 6
36
37L<Debugging|Catalyst::Manual::Tutorial::Debugging>
38
39=item 7
40
41L<Testing|Catalyst::Manual::Tutorial::Testing>
42
43=item 8
44
45L<AdvancedCRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
46
47=item 9
48
49L<Appendicies|Catalyst::Manual::Tutorial::Appendicies>
50
51=back
52
53
54
55=head1 DESCRIPTION
56
64ccd8a8 57This tutorial provides a nine-part introduction to the Catalyst web
58framework. It seeks to provide a rapid overview of many of its most
59commonly used features. The focus is on the real-world best practices
60required in the construction of nearly all Catalyst applications.
4d583dd8 61
64ccd8a8 62Although the primary target of the tutorial is users new to the Catalyst
63framework, experienced users may wish to review specific sections (for
64example, how to use DBIC for their model classes or how to add
65authentication and authorization to an existing application).
4d583dd8 66
67Subjects covered include:
68
69=over 4
70
71=item *
72
73A simple application that lists and adds books.
74
75=item *
76
77The use of C<DBIx::Class> (DBIC) for the model.
78
79=item *
80
81How to write CRUD (Create, Read, Update and Delete) operations in Catalyst.
82
83=item *
84
85Authentication ("auth").
86
87=item *
88
89Role-based authorization ("authz").
90
91=item *
92
64ccd8a8 93Attempts to provide an example showing current Catalyst 5.70
94practices. For example, the use of C<Catalyst::Plugin::DefaultEnd>,
95DBIC, C<Catalyst::Plugin::ConfigLoader> with myapp.yml, the use of
96C<lib/MyApp/Controller/Root.pm> vs. C<lib/MyApp.pm>, etc.
4d583dd8 97
98=item *
99
100The use of Template Toolkit (TT) and the C<Catalyst::Helper::View::TTSite> view helper.
101
102=item *
103
104Useful techniques for troubleshooting and debugging Catalyst applications.
105
106=item *
107
108The use of SQLite as a database (with code also provided for MySQL and PostgreSQL).
109
110=item *
111
112How to use HTML::Widget for automated form processing and validation.
113
114=back
115
64ccd8a8 116This tutorial intentionally seeks to make the learning process its main
117priority. For example, the level of comments in the code found here
118would like be considered excessive in a "normal project". Because of
119their contextual value, this tutorial will generally favor inline
120comments over a separate discussion in the text. It also deliberately
121tries to demonstrate multiple approaches to various features (in
122general, you should try to be as consistent as possible with your own
123production code).
4d583dd8 124
64ccd8a8 125Furthermore, this tutorial tries to minimize the number of controllers,
126models, TT templates, and database tables. Although this does result in
127things being a bit contrived at times, the concepts should be applicable
128to more complex environments. More complete and complicated example
129applications can be found in the C<examples> area of the Catalyst
130Subversion repository at
131L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/>.
4d583dd8 132
64ccd8a8 133B<Note:> There are a variety of other introductory materials available
134through the Catalyst web site and at
135L<http://dev.catalyst.perl.org/wiki/UserIntroductions> and
136L<http://dev.catalyst.perl.org/>.
4d583dd8 137
138
139
140=head1 VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
141
64ccd8a8 142This tutorial was built using the following resources. Please note that
143you will need to make adjustments for different environments and
144versions:
4d583dd8 145
146=over 4
147
148=item *
149
150OS = CentOS 4 Linux (RHEL 4)
151
152=item *
153
154Catalyst v5.67
155
156=item *
157
158DBIx::Class v0.06002
159
160=item *
161
162Catalyst Plugins
163
64ccd8a8 164You shouldn't be overly concerned about plugin version numbers, but
165there could be cases where the tutorial is impacted by what version
166plugins you use. The plugins used in this tutorial are:
4d583dd8 167
168=over 4
169
170=item *
171
172Catalyst::Plugin::Authentication -- 0.07
173
174=item *
175
176Authentication::Credential::Password -- 0.07
177
178=item *
179
180Catalyst::Plugin::Authentication::Store::DBIC -- 0.06
181
182=item *
183
184Catalyst::Plugin::Authorization::ACL -- 0.06
185
186=item *
187
188Catalyst::Plugin::Authorization::Roles -- 0.04
189
190=item *
191
192Catalyst::Plugin::ConfigLoader -- 0.07
193
194=item *
195
196Catalyst::Plugin::DefaultEnd -- 0.06
197
198=item *
199
200Catalyst::Plugin::Dumper -- 0.000002
201
202=item *
203
204Catalyst::Plugin::HTML::Widget -- 1.1
205
206=item *
207
208Catalyst::Plugin::Session -- 0.05
209
210=item *
211
212Catalyst::Plugin::Session::FastMmap -- 0.12
213
214=item *
215
216Catalyst::Plugin::Session::State::Cookie -- 0.02
217
218=item *
219
220Catalyst::Plugin::Session::Store::FastMmap -- 0.0
221
222=item *
223
224Catalyst::Plugin::StackTrace -- 0.0
225
226=item *
227
228Catalyst::Plugin::Static::Simple -- 0.14
229
230=back
231
232=item *
233
64ccd8a8 234Since the web browser is being used on the same box where Perl and the
235Catalyst development server is running, the URL of
236C<http://localhost:3000> will be used (the Catalyst development server
237defaults to port 3000). If you are running Perl on a different box than
238where your web browser is located (or using a different port number via
239the C<-p> I<port_number> option to the development server), then you
240will need to update the URL you use accordingly.
4d583dd8 241
242=item *
243
64ccd8a8 244Depending on the web browser you are using, you might need to hit
245C<Shift+Reload> to pull a fresh page when testing your application at
246various points. Also, the C<-k> keepalive option to the development
247server can be necessary with some browsers (especially Internet
248Explorer).
4d583dd8 249
250=back
251
252
253
254=head1 CATALYST INSTALLATION
255
64ccd8a8 256Unfortunately, one of the most daunting tasks faced by newcomers to
257Catalyst is getting it installed. Although a compelling strength of
258Catalyst is that it can easily make full use of CPAN, a vast repository
259of Perl modules, this can result in initial installations that are both
260time consuming and frustrating. However, there are a growing number of
261methods that can dramatically ease this undertaking. Of these, the
262following are likely to be applicable to the largest number of potential
263new users:
4d583dd8 264
265=over 4
266
267=item *
268
64ccd8a8 269Matt Trout's C<cat-install>
4d583dd8 270
64ccd8a8 271Available at L<http://www.shadowcatsystems.co.uk/static/cat-install>,
272C<cat-install> can be a quick and painless way to get Catalyst up and
273running. Just download the script from the link above and type C<perl
274cat-install>.
4d583dd8 275
276=item *
277
278Chris Laco's CatInABox
279
64ccd8a8 280Download the tarball from
281L<http://handelframework.com/downloads/CatInABox.tar.gz> and unpack it
282on your machine. Depending on your OS platform, either run C<start.bat>
283or C<start.sh>.
4d583dd8 284
285=item *
286
287Pre-Built VMWare Images
288
64ccd8a8 289Under the VMWare community program, work is ongoing to develop a number
290of VMWare images where an entire Catalyst development environment has
291already been installed, complete with database engines and a full
292complement of Catalyst plugins.
4d583dd8 293
294=back
295
64ccd8a8 296B<IMPORTANT:> For additional information and recommendations on Catalyst
297installation, please refer to
298L<Catalyst::Manual::Installation|Catalyst::Manual::Installation>.
4d583dd8 299
64ccd8a8 300B<IMPORTANT:> Step-by-step instructions to replicate the environment on
301which this tutorial was developed can be found at
302L<Catalyst::Manual::Installation::CentOSTuorial|Catalyst::Manual::Installation::CentOSTuorial>.
303
304Using these instructions, you should be able to build a complete CentOS
3054.X server with Catalyst and all the plugins required to run this
306tutorial.
4d583dd8 307
308
309
310=head1 DATABASES
311
64ccd8a8 312This tutorial will primarily focus on SQLite because of its simplicity;
313however, modifications in the script required to support MySQL and
314PostgreSQL will be presented in Appendix 2.
4d583dd8 315
64ccd8a8 316B<Note:> One of the advantages of the MVC design patterns is that
317applications become much more database independent. As such, you will
318notice that only the C<.sql> files used to initialize the database
319change between database systems... the Catalyst code generally remains
320the same.
4d583dd8 321
322
323
324=head1 WHERE TO GET WORKING CODE
325
64ccd8a8 326Each part of the tutorial has complete code available in the main
327Catalyst Subversion repository (see the note at the beginning of each
328part for the appropriate svn command to use). Additionally, the final
329code is available as a ready-to-run tarball at
330TO_BE_ADDED_TO_FINAL_VERSION.
4d583dd8 331
332
333=head1 AUTHOR
334
335Kennedy Clark, C<hkclark@gmail.com>
336
337Please report any errors, issues or suggestions to the author.
338
64ccd8a8 339Copyright 2006, Kennedy Clark, under Creative Commons License
340(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
4d583dd8 341
342Version: .94
343