some work on Tut docs
[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
4d583dd8 6=head1 OVERVIEW
7
653f4595 8This is B<Part 1 of 9> of the Catalyst Tutorial.
4d583dd8 9
64ccd8a8 10L<Tutorial Overview|Catalyst::Manual::Tutorial>
4d583dd8 11
12=over 4
13
14=item 1
15
16B<Introduction>
17
18=item 2
19
20L<Catalyst Basics|Catalyst::Manual::Tutorial::CatalystBasics>
21
22=item 3
23
653f4595 24L<Basic CRUD|Catalyst::Manual::Tutorial::BasicCRUD>
4d583dd8 25
26=item 4
27
28L<Authentication|Catalyst::Manual::Tutorial::Authentication>
29
30=item 5
31
32L<Authorization|Catalyst::Manual::Tutorial::Authorization>
33
34=item 6
35
36L<Debugging|Catalyst::Manual::Tutorial::Debugging>
37
38=item 7
39
40L<Testing|Catalyst::Manual::Tutorial::Testing>
41
42=item 8
43
653f4595 44L<Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
4d583dd8 45
46=item 9
47
653f4595 48L<Appendices|Catalyst::Manual::Tutorial::Appendices>
4d583dd8 49
50=back
51
4d583dd8 52=head1 DESCRIPTION
53
653f4595 54This tutorial provides a multipart introduction to the Catalyst web
55framework. It seeks to provide a rapid overview of many of its most
56commonly used features. The focus is on the real-world best practices
64ccd8a8 57required in the construction of nearly all Catalyst applications.
4d583dd8 58
64ccd8a8 59Although the primary target of the tutorial is users new to the Catalyst
60framework, experienced users may wish to review specific sections (for
61example, how to use DBIC for their model classes or how to add
62authentication and authorization to an existing application).
4d583dd8 63
64Subjects covered include:
65
66=over 4
67
68=item *
69
70A simple application that lists and adds books.
71
72=item *
73
653f4595 74The use of L<DBIx::Class> (DBIC) for the model.
4d583dd8 75
76=item *
77
653f4595 78How to write CRUD (Create, Read, Update, and Delete) operations in
79Catalyst.
4d583dd8 80
81=item *
82
83Authentication ("auth").
84
85=item *
86
87Role-based authorization ("authz").
88
89=item *
90
653f4595 91Attempts to provide an example showing current (5.70) Catalyst
92practices. For example, the use of L<Catalyst::Plugin::DefaultEnd>,
93DBIC, L<Catalyst::Plugin::ConfigLoader> with C<myapp.yml>, the use of
64ccd8a8 94C<lib/MyApp/Controller/Root.pm> vs. C<lib/MyApp.pm>, etc.
4d583dd8 95
96=item *
97
653f4595 98The use of Template Toolkit (TT) and the
99L<Catalyst::Helper::View::TTSite> view helper.
4d583dd8 100
101=item *
102
653f4595 103Useful techniques for troubleshooting and debugging Catalyst
104applications.
4d583dd8 105
106=item *
107
653f4595 108The use of SQLite as a database (with code also provided for MySQL and
109PostgreSQL).
4d583dd8 110
111=item *
112
653f4595 113The use of HTML::Widget for automated form processing and validation.
4d583dd8 114
115=back
116
653f4595 117This tutorial makes the learning process its main priority. For
118example, the level of comments in the code found here would like be
119considered excessive in a "normal project". Because of their contextual
120value, this tutorial will generally favor inline comments over a
121separate discussion in the text. It also deliberately tries to
122demonstrate multiple approaches to various features (in general, you
123should try to be as consistent as possible with your own production
124code).
4d583dd8 125
64ccd8a8 126Furthermore, this tutorial tries to minimize the number of controllers,
127models, TT templates, and database tables. Although this does result in
128things being a bit contrived at times, the concepts should be applicable
129to more complex environments. More complete and complicated example
130applications can be found in the C<examples> area of the Catalyst
131Subversion repository at
132L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/>.
4d583dd8 133
64ccd8a8 134B<Note:> There are a variety of other introductory materials available
135through the Catalyst web site and at
136L<http://dev.catalyst.perl.org/wiki/UserIntroductions> and
137L<http://dev.catalyst.perl.org/>.
4d583dd8 138
4d583dd8 139=head1 VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
140
653f4595 141This tutorial was built using the following resources. Please note that
142you may need to make adjustments for different environments and
64ccd8a8 143versions:
4d583dd8 144
145=over 4
146
147=item *
148
149OS = CentOS 4 Linux (RHEL 4)
150
151=item *
152
153Catalyst v5.67
154
155=item *
156
157DBIx::Class v0.06002
158
159=item *
160
161Catalyst Plugins
162
653f4595 163The plugins used in this tutorial all have sufficiently stable APIs that
164you shouldn't need to worry about versions. However, there could be
165cases where the tutorial is affected by what version of plugins you
166use. The plugins used for 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
4d583dd8 252=head1 CATALYST INSTALLATION
253
64ccd8a8 254Unfortunately, one of the most daunting tasks faced by newcomers to
255Catalyst is getting it installed. Although a compelling strength of
653f4595 256Catalyst is that it can easily make use of many of the modules in the
257vast repository that is CPAN, this can result in initial installations
258that are both time consuming and frustrating. However, there are a
259growing number of methods that can dramatically ease this undertaking.
260Of these, the following are likely to be applicable to the largest
261number of potential new users:
4d583dd8 262
263=over 4
264
265=item *
266
64ccd8a8 267Matt Trout's C<cat-install>
4d583dd8 268
64ccd8a8 269Available at L<http://www.shadowcatsystems.co.uk/static/cat-install>,
270C<cat-install> can be a quick and painless way to get Catalyst up and
271running. Just download the script from the link above and type C<perl
272cat-install>.
4d583dd8 273
274=item *
275
276Chris Laco's CatInABox
277
64ccd8a8 278Download the tarball from
279L<http://handelframework.com/downloads/CatInABox.tar.gz> and unpack it
280on your machine. Depending on your OS platform, either run C<start.bat>
281or C<start.sh>.
4d583dd8 282
283=item *
284
285Pre-Built VMWare Images
286
64ccd8a8 287Under the VMWare community program, work is ongoing to develop a number
288of VMWare images where an entire Catalyst development environment has
289already been installed, complete with database engines and a full
290complement of Catalyst plugins.
4d583dd8 291
292=back
293
653f4595 294For additional information and recommendations on Catalyst installation,
295please refer to L<Catalyst::Manual::Installation>.
4d583dd8 296
64ccd8a8 297B<IMPORTANT:> Step-by-step instructions to replicate the environment on
298which this tutorial was developed can be found at
653f4595 299L<Catalyst::Manual::Installation::CentOS4>.
64ccd8a8 300
301Using these instructions, you should be able to build a complete CentOS
3024.X server with Catalyst and all the plugins required to run this
303tutorial.
4d583dd8 304
4d583dd8 305=head1 DATABASES
306
653f4595 307This tutorial will primarily focus on SQLite because of its simplicity
308of installation and use; however, modifications in the script required
309to support MySQL and PostgreSQL will be presented in Appendix 2.
4d583dd8 310
64ccd8a8 311B<Note:> One of the advantages of the MVC design patterns is that
312applications become much more database independent. As such, you will
313notice that only the C<.sql> files used to initialize the database
653f4595 314change between database systems: the Catalyst code generally remains the
315same.
4d583dd8 316
317=head1 WHERE TO GET WORKING CODE
318
64ccd8a8 319Each part of the tutorial has complete code available in the main
320Catalyst Subversion repository (see the note at the beginning of each
321part for the appropriate svn command to use). Additionally, the final
322code is available as a ready-to-run tarball at
323TO_BE_ADDED_TO_FINAL_VERSION.
4d583dd8 324
4d583dd8 325=head1 AUTHOR
326
327Kennedy Clark, C<hkclark@gmail.com>
328
329Please report any errors, issues or suggestions to the author.
330
64ccd8a8 331Copyright 2006, Kennedy Clark, under Creative Commons License
332(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
4d583dd8 333
334Version: .94
335