Misc minor updates
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Tutorial / 01_Intro.pod
CommitLineData
d442cc9f 1=head1 NAME
2
3ab6187c 3Catalyst::Manual::Tutorial::01_Intro - Catalyst Tutorial - Chapter 1: Introduction
d442cc9f 4
5
6=head1 OVERVIEW
7
4b4d3884 8This is B<Chapter 1 of 10> for the Catalyst tutorial.
d442cc9f 9
10L<Tutorial Overview|Catalyst::Manual::Tutorial>
11
12=over 4
13
14=item 1
15
3ab6187c 16B<01_Introduction>
d442cc9f 17
18=item 2
19
3ab6187c 20L<Catalyst Basics|Catalyst::Manual::Tutorial::02_CatalystBasics>
d442cc9f 21
22=item 3
23
3ab6187c 24L<More Catalyst Basics|Catalyst::Manual::Tutorial::03_MoreCatalystBasics>
d442cc9f 25
26=item 4
27
3ab6187c 28L<Basic CRUD|Catalyst::Manual::Tutorial::04_BasicCRUD>
d442cc9f 29
30=item 5
31
3ab6187c 32L<Authentication|Catalyst::Manual::Tutorial::05_Authentication>
d442cc9f 33
34=item 6
35
3ab6187c 36L<Authorization|Catalyst::Manual::Tutorial::06_Authorization>
d442cc9f 37
38=item 7
39
3ab6187c 40L<Debugging|Catalyst::Manual::Tutorial::07_Debugging>
d442cc9f 41
42=item 8
43
3ab6187c 44L<Testing|Catalyst::Manual::Tutorial::08_Testing>
d442cc9f 45
46=item 9
47
3ab6187c 48L<Advanced CRUD|Catalyst::Manual::Tutorial::09_AdvancedCRUD>
1def4a20 49
50=item 10
51
3ab6187c 52L<Appendices|Catalyst::Manual::Tutorial::10_Appendices>
d442cc9f 53
54=back
55
1def4a20 56
d442cc9f 57=head1 DESCRIPTION
58
ffeb7448 59This tutorial provides a multi-part introduction to the Catalyst web
d442cc9f 60framework. It seeks to provide a rapid overview of many of its most
61commonly used features. The focus is on the real-world best practices
62required in the construction of nearly all Catalyst applications.
63
64Although the primary target of the tutorial is users new to the Catalyst
65framework, experienced users may wish to review specific sections (for
1def4a20 66example, how to use DBIC for their model classes, how to add
8168726b 67authentication and authorization to an existing application, and/or
68form management).
d442cc9f 69
70You can obtain the code for all the tutorial examples from the
71catalyst subversion repository by issuing the command:
72
028b4e1a 73 svn co http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/ CatalystTutorial
d442cc9f 74
75b13da6 75This will download the most recent code for each chapter of the
76tutorial into the CatalystTutorial directory on your machine.
d442cc9f 77
3d9ae335 78B<These reference implementations are provided so that when you follow
79the tutorial, you can use the code from the subversion repository to
80ensure that your system is set up correctly, and that you have not
81inadvertently made any typographic errors, or accidentally skipped
82part of the tutorial.>
83
8168726b 84B<NOTE: You can use any Perl-supported OS and environment to run
85Catalyst.> It should make little or no difference to Catalyst's
a6b4cff5 86operation, B<but this tutorial has been written using the Debian 6 Live
8168726b 87CD> because that represents a quick and easy way for most people to try
88out Catalyst with virtually zero setup time and hassles. Also, the
89tutorial has been tested to work correctly with the versions of Catalyst
90and all the supporting modules in Debian 6 (see "VERSIONS AND
91CONVENTIONS USED IN THIS TUTORIAL" below for the specific versions for
92some of the key modules), so B<if you think you might be running into an
93issue related to versions> (for example, a module changed its behavior
94in a newer version or a bug was introduced), B<it might be worth giving
95Debian 6 a try>.
96
97If you plan to follow along with Debian 6, you can jump down to the
98"Debian" section under L</"CATALYST INSTALLATION"> below and it will
99walk you though the setup of a fully functional Catalyst environment. If
100you would prefer to install directly from CPAN, you can download the
101example program and all the necessary dependencies to your local machine
102by installing the C<Task::Catalyst::Tutorial> distribution:
d442cc9f 103
104 cpan Task::Catalyst::Tutorial
105
106This will also test to make sure the dependencies are working. If you
107have trouble installing these, please ask for help on the #catalyst
108IRC channel, or the Catalyst mailing list.
109
3533daff 110Subjects covered by the tutorial include:
d442cc9f 111
112=over 4
113
114=item *
115
116A simple application that lists and adds books.
117
118=item *
119
8168726b 120The use of L<DBIx::Class|DBIx::Class> (DBIC) for the model (including
121some of the more advanced techniques you will probably want to use in
acbd7bdd 122your applications).
d442cc9f 123
124=item *
125
126How to write CRUD (Create, Read, Update, and Delete) operations in
127Catalyst.
128
129=item *
130
131Authentication ("auth").
132
133=item *
134
135Role-based authorization ("authz").
136
137=item *
138
8168726b 139Attempts to provide an example showing current (5.9) Catalyst
140practices.
d442cc9f 141
142=item *
143
1390ef0e 144The use of Template Toolkit (TT).
d442cc9f 145
146=item *
147
148Useful techniques for troubleshooting and debugging Catalyst
149applications.
150
151=item *
152
153The use of SQLite as a database (with code also provided for MySQL and
8168726b 154PostgreSQL). (Note: Because we make use of the DBIx::Class Object
444d6b27 155Relational Mapping [ORM] layer, out our application will be database
8168726b 156agnostic and can easily be used by any of the databases supported by
157DBIx::Class.)
d442cc9f 158
159=item *
160
0abc72ed 161The use of L<HTML::FormFu|HTML::FormFu> or L<HTML::FormHandler|HTML::FormHandler>
162for automated form processing and validation.
d442cc9f 163
164=back
165
166This tutorial makes the learning process its main priority. For
167example, the level of comments in the code found here would likely be
1def4a20 168considered excessive in a "normal project." Because of their contextual
d442cc9f 169value, this tutorial will generally favor inline comments over a
170separate discussion in the text. It also deliberately tries to
171demonstrate multiple approaches to various features (in general, you
172should try to be as consistent as possible with your own production
173code).
174
175Furthermore, this tutorial tries to minimize the number of controllers,
176models, TT templates, and database tables. Although this does result in
177things being a bit contrived at times, the concepts should be applicable
178to more complex environments. More complete and complicated example
179applications can be found in the C<examples> area of the Catalyst
180Subversion repository at
181L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/>.
8168726b 182***Todo: update link above?
d442cc9f 183
1390ef0e 184
2e73e2be 185=head1 QUICK START
186
8168726b 187For those who want to get going quickly, here is a short "cookbook-style
188recipe" to quickly get you up and running. Although there are many
189different ways to get a Catalyst environment going, this tutorial has
a6b4cff5 190been written with and tested against the Debian 6 Live CD, using the
191steps in this Quick Start.
2e73e2be 192
8168726b 193If you want, you can follow the directions in this section and then jump
194right to L<Chapter 2|Catalyst::Manual::Tutorial::02_CatalystBasics> of
195the tutorial. However, it would be a good idea to come back and read the
196sections below the Quick Start when you have time. Or, continue reading
197those other sections for suggestions if you do not wish to use the
198Debian 6 Live CD.
2e73e2be 199
2e73e2be 200=over 4
201
202=item 1
203
8168726b 204Download the C<debian-live-6.0.1-i386-rescue.iso> image from
205L<http://cdimage.debian.org/cdimage/release/current-live/i386/iso-hybrid/>.
2e73e2be 206
207=item 2
208
209Boot this disk, either in a physical machine, or possibly some sort
8168726b 210of virtual machine (using a VM can be a very handy way to practice).
2e73e2be 211
212=item 3
213
214Select "C<Live>" from the initial boot menu.
215
216=item 4
217
218At the "C<user@debian:~$>" prompt, type:
219
220 sudo aptitude -y install subversion
221
222=item 5
223
224If you want to be able to remotely SSH to this system, set a
a6b4cff5 225password for root (you might want to do "dpkg -l | grep openssh-server"
226to be sure the ISO image you downloaded has the SSH daemon installed...
227if it's missing, do a "sudo aptitude -y install openssh-server"):
2e73e2be 228
229 sudo passwd
230 ...
231
232=item 6
233
234Add the "unstable" Debian package repository:
235
236 sudo vi /etc/apt/sources.list
237
238Add the following line to the bottom of this file:
239
240 deb http://ftp.us.debian.org/debian/ unstable main
241
242=item 7
243
244Install Catalyst and related libraries:
245
246 sudo aptitude update
247 sudo aptitude -y install sqlite3 libdbd-sqlite3-perl libcatalyst-perl \
248 libcatalyst-modules-perl libdbix-class-timestamp-perl \
249 libdatetime-format-sqlite-perl libconfig-general-perl \
250 libhtml-formfu-model-dbic-perl libterm-readline-perl-perl \
195424f2 251 libdbix-class-encodedcolumn-perl libperl6-junction-perl \
252 libtest-pod-perl
2e73e2be 253 sudo aptitude clean
254
255=item 8
256
257Test example code:
258
259 mkdir test
260 cd test
261 svn co http://dev.catalystframework.org/repos/Catalyst/trunk/examples/Tutorial/MyApp_Chapter8
262 cd MyApp_Chapter8/MyApp
263 CATALYST_DEBUG=0 prove -wl t
264 cd
265
266=back
267
268
d442cc9f 269=head1 VERSIONS AND CONVENTIONS USED IN THIS TUTORIAL
270
271This tutorial was built using the following resources. Please note that
a6b4cff5 272you may need to make adjustments for different environments and versions
273(note that trailing zeros in version numbers are not significant and may
274get dropped with some techniques for viewing them; for example, Catalyst
275v5.80020 might show up as 5.8002):
d442cc9f 276
277=over 4
278
279=item *
280
acbd7bdd 281Debian 5 (Lenny)
d442cc9f 282
283=item *
284
6163536a 285Catalyst v5.80020 (note: may show up as '5.8002' without the trailing zero)
dd88c3b6 286
22a67212 287=item *
dd88c3b6 288
6163536a 289Catalyst::Devel v1.26
d442cc9f 290
291=item *
292
6163536a 293DBIx::Class v0.08115
d442cc9f 294
fce83e5f 295=item *
296
2e73e2be 297Catalyst::Model::DBIC::Schema v0.40
298
299=item *
300
fce83e5f 301Template Toolkit v2.20
302
2e73e2be 303
d442cc9f 304=item *
305
306Catalyst Plugins
307
308The plugins used in this tutorial all have sufficiently stable APIs that
309you shouldn't need to worry about versions. However, there could be
310cases where the tutorial is affected by what version of plugins you
311use. This tutorial has been tested against the following set of plugins:
312
313=over 4
314
315=item *
316
6163536a 317Catalyst::Plugin::Authentication -- v0.10016
d442cc9f 318
319=item *
320
6163536a 321Catalyst::Plugin::Authorization::Roles -- v0.08
d442cc9f 322
323=item *
324
f34d7f62 325Catalyst::Plugin::ConfigLoader -- v0.27
d442cc9f 326
327=item *
328
f34d7f62 329Catalyst::Plugin::Session -- v0.29
d442cc9f 330
331=item *
332
f34d7f62 333Catalyst::Plugin::Session::State::Cookie -- v0.17
d442cc9f 334
335=item *
336
95455c74 337Catalyst::Plugin::Session::Store::File -- v0.18
d442cc9f 338
339=item *
340
f34d7f62 341Catalyst::Plugin::StackTrace -- v0.11
d442cc9f 342
343=item *
344
2e73e2be 345Catalyst::Plugin::Static::Simple -- v0.29
d442cc9f 346
347=back
348
2e73e2be 349=item *
350
351HTML::FormFu -- v0.06001
352
d442cc9f 353=item *
354
865d3efb 355B<NOTE:> You can check the versions you have installed with the
356following command:
357
f63a9a2b 358 perl -M<_mod_name_> -e 'print "$<_mod_name_>::VERSION\n"'
865d3efb 359
360For example:
865d3efb 361
444d6b27 362 perl -MCatalyst -e 'print "$Catalyst::VERSION\n";'
363
364or:
365
366 perl -MCatalyst::Devel -e 'print "$Catalyst::Devel::VERSION\n";'
d442cc9f 367
368=item *
369
8168726b 370This tutorial will assume that the web browser is located on the same
371system where the Catalyst development server is running, and therefore
372use a URL of C<http://localhost:3000> (the Catalyst development server
a6b4cff5 373defaults to port 3000, but can be changed with the "-p" option to the
374development server). If you are running Perl on a different box than
8168726b 375where your web browser is located (or using a different port number via
376the C<-p> I<port_number> option to the development server), then you
377will need to update the URL you use accordingly.
378
379Please Note: Depending on the web browser you are using, you might need
380to hit C<Shift+Reload> or C<Ctrl+Reload> to pull a fresh page when
381testing your application at various points (see
382L<http://en.wikipedia.org/wiki/Bypass_your_cache> for a comprehensive
383list of options for each browser). Also, the C<-k> keepalive option to
384the development server can be necessary with some browsers (especially
385Internet Explorer). ***Todo: is this still true?
d442cc9f 386
387=back
388
1390ef0e 389
d442cc9f 390=head1 CATALYST INSTALLATION
391
8168726b 392Although Catalyst installation has been a challenge in the past, the
393good news is that there are a growing number of options to eliminate (or
394at least dramatically simplify) this concern. Although a compelling
395strength of Catalyst is that it makes use of many of the modules in the
396vast repository that is CPAN, this can complicate the installation
397process if you approach it in the wrong way. Consider the following
398suggestions on the most common ways to get started with a Catalyst
399development environment:
1def4a20 400
401=over 4
402
403=item *
404
acbd7bdd 405Debian
406
8168726b 407The Debian 6 Live CD represents a great way for newcomers to experiment
408with Catalyst. As a "live CD," you can simple boot from the CD, run a
409few commands, and in a matter of minutes you should have a fully
410function environment in which do this tutorial. B<The tutorial was fully
411tested to work under Debian 6. Although it SHOULD work under any
412Catalyst installation method you might choose, it can be hard to
413guarantee this.>
acbd7bdd 414
415=over 4
416
417=item *
418
8168726b 419Download one of the ISO files from
420L<http://cdimage.debian.org/cdimage/release/current-live/i386/iso-hybrid/>
421(the current version at the time this was written was 6.0.1). You can
422pick any one of the live CD variations will work, but you may wish to
423consider the following points:
acbd7bdd 424
425=over 4
426
427=item *
428
8168726b 429"C<debian-live-6.0.1-i386-rescue.iso>" is probably the best all-around
430option for most people because it includes many extra tools such as the
431GCC compiler, therefore saving RAM (every package you need to install
a6b4cff5 432when running from a Live CD consumes memory because RAM disk is being
433used in lieu of real disk space). When initially booting under this
434image, you may see some cryptic warning messages having to do with
435various diagnostic tools it tries to load or enable, but you should be
436able to safely ignore these.
acbd7bdd 437
438=item *
439
8168726b 440"C<debian-live-6.0.1-i386-standard.iso>" is a great option because of
441its compact size, but you will probably need approximately 1 GB of RAM
442in the computer where you will run the tutorial. Because the "standard"
443live CD comes with with a minimal set of tools, we will have to install
444extra packages (such as the GCC compiler), all of which will require RAM
445when running from a live CD.
acbd7bdd 446
447=item *
448
8168726b 449The other ISO images include different flavors of X-Windows desktop
450managers. You can select one of these if you don't mind the larger
451download size and prefer a graphical environment. Be aware that these
452disks do not come with the extra tools found on the "rescue" image, so
453you will need adequate RAM to be able to install them just as you would
454under the "standard" image. B<Use one of the "graphical" ISO images if
455you want a graphical web browser on the same machine as where you will
456run the tutorial.> (If you are using one of the non- graphical images
457discussed above, you can still use a graphical web browser from another
458machine and point it to your Catalyst development machine.)
acbd7bdd 459
460=back
461
462=item *
463
464Boot off the CD.
465
466=item *
467
468Select "C<Live>" from the initial boot menu.
469
470=item *
471
6163536a 472Once the system has booted to a "C<user@debian:~$>" prompt, first
473install the Subversion client in case you want to check out the
474completed chapter example code:
475
0ed3df53 476 sudo aptitude -y install subversion
6163536a 477
2e73e2be 478If you want to be able to remotely SSH to this system, set a
479password for root:
480
481 sudo passwd
482 ...
483
8168726b 484Then enter the following command to add the more current "unstable"
485package repository so we get the latest versions of Catalyst and related
486packages:
acbd7bdd 487
488 sudo vi /etc/apt/sources.list
489
490Add the following line to the bottom of this file:
491
492 deb http://ftp.us.debian.org/debian/ unstable main
493
8168726b 494If you are not familiar with VI, you can move to the bottom of this file
495and press the "o" key to insert a new line and type the line above.
496Then press the "Esc" key followed by a colon (":"), the letters "wq" and
497then the "Enter" key. The rest of the tutorial will assume that you
498know how to use some editor that is available from the Linux
499command-line environment.
acbd7bdd 500
501=item *
502
503Install Catalyst:
504
505 sudo aptitude update
506 sudo aptitude -y install sqlite3 libdbd-sqlite3-perl libcatalyst-perl \
444d6b27 507 libcatalyst-modules-perl libdbix-class-timestamp-perl \
2314f851 508 libdatetime-format-sqlite-perl libconfig-general-perl \
9314188c 509 libhtml-formfu-model-dbic-perl libterm-readline-perl-perl \
195424f2 510 libdbix-class-encodedcolumn-perl libperl6-junction-perl \
511 libtest-pod-perl
444d6b27 512
513Let it install (normally about a 30 to 90-second operaton) and you are
514done. (Note the '\' above. Depending on your environment, you might
515be able to cut and paste the text as shown or need to remove the '\'
fce83e5f 516characters to that the command is all on a single line.)
acbd7bdd 517
518If you are using an image other than the "rescue" ISO, you will also need
519to run the following command to install additional packages:
520
521 sudo aptitude -y install gcc make libc6-dev
522
8168726b 523If you are running from the Live CD, you probably also want to free up
acbd7bdd 524some RAM disk space with the following:
525
526 sudo aptitude clean
527
8168726b 528NOTE: While the instructions above mention the Live CD because that
529makes it easy for people new to Linux, you can obviously pick a
530different Debian ISO image and install it to your hard drive. Although
531there are many different ways to download and install Debian, the
532"netinst" ISO image (such as "C<debian-500-i386-netinst.iso>" represents
533a great option because it keeps your initial download small (but still
534lets you install anything you want "over the network").
acbd7bdd 535
536Here are some tips if you are running from a live CD and are running
537out of disk space (which really means you are running out of RAM):
538
539=over 4
540
541=item *
542
8168726b 543Always run "C<aptitude clean>" after you install new packages to delete
544the original .deb files (the files installed B<by> the .deb package
545B<will> remain available, just the .deb package itself is deleted).
acbd7bdd 546
547=item *
548
8168726b 549If you are installing modules from CPAN, you can free up some space with
550"C<rm -rf /root/.cpan/*>" (change "/root/" in the previous command to
551match your home directory or the location where CPAN has been configured
552to perform build operations).
acbd7bdd 553
554=item *
555
8168726b 556If necessary, you can remove the cached package information with the
557command "C<rm -f /var/lib/apt/lists/*>". You can later pull this
acbd7bdd 558information again via the command "C<aptitude update>".
559
560=item *
561
8168726b 562You can save a small amount of space by commenting out the lines in
563C</etc/apt/sources.list> that reference "deb-src" and
564"security.debian.org". If you have already done an "C<aptitude update>"
565with these repositories enabled, you can use the tip in the previous
566bullet to free the space up (and then do another "C<aptitude update>").
acbd7bdd 567
568=item *
569
8168726b 570Although you can free up space by removing packages you installed since
a6b4cff5 571you last booted (check out "C<aptitude remove _pkg_name_>"), don't bother
8168726b 572trying to remove packages already available at the time of boot. Instead
a6b4cff5 573of freeing up space, it will actual consume I<more> space. (The live CD
8168726b 574uses these "burn in" packages right from the CD disk vs. first loading
575them on the virtual RAM disk. However, if you remove them, the system
576has to update various files, something that I<does> consume some space
577on the virtual RAM disk.)
acbd7bdd 578
579=back
580
581=back
582
583=item *
584
1def4a20 585Ubuntu
586
a6b4cff5 587Ubuntu is a popular offshoot of Debian. It provides cutting edge
588versions of many common tools, application and libraries in an
8168726b 589easy-to-run live CD configuration (and because a single download option
590can be used for both live CD and install-to-disk usage, it keeps your
591download options nice and simple). As with Debian 6, you should be able
592to generate a fully function Catalyst environment in a matter of
593minutes. Here are quick instructions on how to use Ubuntu to prepare
594for the tutorial:
d442cc9f 595
596=over 4
597
598=item *
599
8168726b 600Download the Ubuntu Desktop edition and boot from the CD and/or image
601file, select your language, and then "Try Ubuntu without any changes to
602your computer."
1def4a20 603
604=item *
605
8168726b 606Open a terminal session (click "Applications" in the upper-left corner,
607then "Accessories," then "Terminal").
1def4a20 608
609=item *
610
611Add the 'universe' repositories:
612
3533daff 613 sudo gedit /etc/apt/sources.list
1def4a20 614
615And remove the comments from the lines under the comments about the
616'universe' repositories.
617
618=item *
619
620Install Catalyst:
621
acbd7bdd 622 sudo aptitude update
623 sudo aptitude install libdbd-sqlite3-perl libcatalyst-perl libcatalyst-modules-perl libconfig-general-perl
1def4a20 624
8168726b 625Accept all of the dependencies. Done.
2b75577c 626
8168726b 627If you are running from the Live CD, you probably also want to free up
2b75577c 628some disk space with the following:
629
acbd7bdd 630 sudo aptitude clean
2b75577c 631
8168726b 632NOTE: While the instructions above mention the live CD because that
633makes it easy for people new to Linux, you can obviously also use one of
634the options to install Ubuntu on your drive.
3533daff 635
1def4a20 636=back
637
638=item *
639
d442cc9f 640Matt Trout's C<cat-install>
641
8168726b 642Available at L<http://www.shadowcat.co.uk/static/cat-install>,
643C<cat-install> can be a fairly painless way to get Catalyst up and
a6b4cff5 644running. Just download the script from the link above and type
645C<perl cat-install>. Depending on the speed of your Internet connection
646and your computer, it will probably take 30 to 60 minutes to install
647because it downloads, makes, compiles, and tests every module. But this
648is an excellent way to automate the installation of all the latest
649modules used by Catalyst from CPAN.
ffeb7448 650
d442cc9f 651
652=item *
653
ffeb7448 654Other Possibilities
655
656=over 4
657
658=item *
659
660OpenBSD Packages
661
8168726b 662The 2008 Advent Day 4 entry has more information on using OpenBSD
663packages to quickly build a system:
ffeb7448 664L<http://www.catalystframework.org/calendar/2008/4>.
665
666=item *
d442cc9f 667
ffeb7448 668NetBSD Package Collection on Solaris
669
8168726b 670The 2008 Advent Day 15 entry has more information on using C<pkgsrc> and
671NetBSD packages on Solaris:
1435672d 672L<http://www.catalystframework.org/calendar/2008/15>.
d442cc9f 673
674=item *
675
ffeb7448 676CatInABox
677
8168726b 678You can get more information at
679L<http://www.catalystframework.org/calendar/2008/7> or
680L<Perl::Dist::CatInABox|Perl::Dist::CatInABox>.
ffeb7448 681
0c51850e 682=item *
683
684Frank Speiser's Amazon EC2 Catalyst SDK
685
686There are currently two flavors of publicly available Amazon Machine
687Images (AMI) that include all the elements you'd need to begin
688developing in a fully functional Catalyst environment within minutes.
689See L<Catalyst::Manual::Installation|Catalyst::Manual::Installation>
690for more details.
691
d442cc9f 692=back
693
ffeb7448 694=back
695
d442cc9f 696For additional information and recommendations on Catalyst installation,
8168726b 697please refer to
d442cc9f 698L<Catalyst::Manual::Installation|Catalyst::Manual::Installation>.
699
1390ef0e 700
d442cc9f 701=head1 DATABASES
702
703This tutorial will primarily focus on SQLite because of its simplicity
704of installation and use; however, modifications in the script required
a6b4cff5 705to support MySQL and PostgreSQL will be presented in the Appendix.
d442cc9f 706
a6b4cff5 707B<Note:> One of the advantages of using tools like Catalyst and DBIC is
708that applications become much more database independent. As such, you
709will notice that only the C<.sql> files used to initialize the database
710change between database systems: most of the code generally remains the
d442cc9f 711same.
712
1390ef0e 713
d442cc9f 714=head1 WHERE TO GET WORKING CODE
715
8168726b 716Each chapter of the tutorial has complete code available as a tarball in
717the main Catalyst Subversion repository (see the note at the beginning
028b4e1a 718of each part for the appropriate svn command to use).
d442cc9f 719
8168726b 720B<NOTE:> You can run the test cases for the final code through Chapter 8
028b4e1a 721with the following commands:
d442cc9f 722
0ed3df53 723 svn co http://dev.catalystframework.org/repos/Catalyst/trunk/examples/Tutorial/MyApp_Chapter8
724 cd MyApp_Chapter8/MyApp
96a87356 725 CATALYST_DEBUG=0 prove -wl t
d442cc9f 726
96a87356 727If you wish to include the L<HTML::FormFu|HTML::FormFu> section in your tests,
6163536a 728substitute C<MyApp_Chapter9_FormFu> for C<MyApp_Chapter8> in the URL
729above (don't forget to "cd" out of the Ch8 directory if you ran the code above).
acbd7bdd 730
0ed3df53 731 svn co http://dev.catalystframework.org/repos/Catalyst/trunk/examples/Tutorial/MyApp_Chapter9_FormFu
732 cd MyApp_Chapter9_FormFu/MyApp
96a87356 733 CATALYST_DEBUG=0 prove -wl t
acbd7bdd 734
735You can also fire up the application under the development server that is conveniently
736built in to Catalyst. Just issue this command from the C<MyApp> directory where you
737ran the test suite above:
738
739 script/myapp_server.pl
740
8168726b 741And the application will start. You can try out the application by
742pulling up C<http://localhost:3000> in your web browser (as mentioned
743earlier, change C<localhost> to a different IP address or DNS name if
744you are running your web browser and your Catalyst development on
745different boxes). We will obviously see more about how to use the
746application as we go through the remaining chapters of the tutorial, but
747for now you can log in using the username "test01" and a password of
acbd7bdd 748"mypass".
749
d442cc9f 750
751=head1 AUTHOR
752
753Kennedy Clark, C<hkclark@gmail.com>
754
8168726b 755Please report any errors, issues or suggestions to the author. The
756most recent version of the Catalyst Tutorial can be found at
59884771 757L<http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Manual/5.80/trunk/lib/Catalyst/Manual/Tutorial/>.
d442cc9f 758
ec3ef4ad 759Copyright 2006-2010, Kennedy Clark, under the
760Creative Commons Attribution Share-Alike License Version 3.0
865d3efb 761(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).