X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FCatalystBasics.pod;h=ee43d241022dfb550ea3b12d1048d5a2cbda222b;hb=45569686c8d290df9fb4bd6a89ec1fcf6b5bbcb2;hp=f378f13328c5ac62f66ba05652d8ba8b28f9ae6a;hpb=4d583dd846a0ffa9bd224014f89df39db957c35f;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod index f378f13..ee43d24 100644 --- a/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod @@ -1,14 +1,13 @@ =head1 NAME -Catalyst::Manual::Tutorial::CatalystBasics - Catalyst Tutorial – Part 2: Catalyst Application Development Basics - +Catalyst::Manual::Tutorial::CatalystBasics - Catalyst Tutorial - Part 2: Catalyst Application Development Basics =head1 OVERVIEW This is B for the Catalyst tutorial. -L +L =over 4 @@ -22,7 +21,7 @@ B =item 3 -L +L =item 4 @@ -42,81 +41,159 @@ L =item 8 -L +L =item 9 -L +L =back - =head1 DESCRIPTION -In this part of the tutorial, we will create a very basic Catalyst web application. Though simple in many respects, this section will already demonstrate a number of powerful capabilities such as: +In this part of the tutorial, we will create a very basic Catalyst web +application. Though simple in many respects, this section will already +demonstrate a number of powerful capabilities such as: =over 4 =item * Helper Scripts -Catalyst helper scripts that can be used to rapidly bootstrap the skeletal structure of an application. +Catalyst helper scripts that can be used to rapidly bootstrap the +skeletal structure of an application. =item * MVC -Model/View/Controller (MVC) provides an architecture that facilitates a clean "separation of control" between the different portions of your application. Given that many other documents cover this subject in detail, MVC will not be discussed in depth here (for an excellent introduction to MVC and general Catalyst concepts, please see L. In short: +Model/View/Controller (MVC) provides an architecture that facilitates a +clean "separation of control" between the different portions of your +application. Given that many other documents cover this subject in +detail, MVC will not be discussed in depth here (for an excellent +introduction to MVC and general Catalyst concepts, please see +L. In short: =over 4 =item * Model -In most applications, the model equates to the objects that are created from and saved to your SQL database. +The model usually represents a data store. In most applications, the +model equates to the objects that are created from and saved to your SQL +database. =item * View -The view takes model objects and renders them into something for the end user to look at. Normally this involves a template-generation tool that creates HTML for the user's web browser, but it could easily be code that generates other forms such as PDF documents or Excel spreadsheets. +The view takes model objects and renders them into something for the end +user to look at. Normally this involves a template-generation tool that +creates HTML for the user's web browser, but it could easily be code +that generates other forms such as PDF documents, e-mails, or Excel +spreadsheets. =item * Controller -As suggested by its name, the controller takes user requests and routes them to the necessary model and view. +As suggested by its name, the controller takes user requests and routes +them to the necessary model and view. =back =item * ORM -The use Object-Relational Mapping (ORM) technology for database access (specifically, ORM provides an automated means to persist and restore objects to/from a relational database). +The use of Object-Relational Mapping (ORM) technology for database +access. Specifically, ORM provides an automated and standardized means +to persist and restore objects to/from a relational database. =back -B: Note that all of the code for this part of the tutorial can be pulled from the Catalyst Subversion repository in one step with the following command: - - svn checkout http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial@### - IMPORTANT: Does not work yet. Will be completed for final version. - - +You can checkout the source code for this example from the catalyst +subversion repository as per the instructions in +L =head1 CREATE A CATALYST PROJECT -Catalyst provides a number of helper scripts that can be used to quickly flesh out the basic structure of your application. All Catalyst projects begin with the C helper. +Catalyst provides a number of helper scripts that can be used to quickly +flesh out the basic structure of your application. All Catalyst projects +begin with the C helper (see L +for more information on helpers). Also note that as of Catalyst 5.7000, +you will not have the helper scripts unless you install both +L and L. -In the case of this tutorial, use the Catalyst C script to initialize the framework for an application called C: +In the case of this tutorial, use the Catalyst C script to +initialize the framework for an application called C: $ catalyst.pl MyApp + created "MyApp" + created "MyApp/script" + created "MyApp/lib" + created "MyApp/root" + ... + created "MyApp/script/myapp_create.pl" $ cd MyApp -The C helper script will display the names of the directories and files it creates. +The C helper script will display the names of the +directories and files it creates. + +Though it's too early for any significant celebration, we already have a +functioning application. Run the following command to run this +application with the built-in development web server: + + $ script/myapp_server.pl + [debug] Debug messages enabled + [debug] Loaded plugins: + .----------------------------------------------------------------------------. + | Catalyst::Plugin::ConfigLoader 0.13 | + | Catalyst::Plugin::Static::Simple 0.14 | + '----------------------------------------------------------------------------' + + [debug] Loaded dispatcher "Catalyst::Dispatcher" + [debug] Loaded engine "Catalyst::Engine::HTTP" + [debug] Found home "/home/me/MyApp" + [debug] Loaded Config "/home/me/myapp.yml" + [debug] Loaded components: + .-----------------------------------------------------------------+----------. + | Class | Type | + +-----------------------------------------------------------------+----------+ + | MyApp::Controller::Root | instance | + '-----------------------------------------------------------------+----------' + + [debug] Loaded Private actions: + .----------------------+--------------------------------------+--------------. + | Private | Class | Method | + +----------------------+--------------------------------------+--------------+ + | /default | MyApp::Controller::Root | default | + | /end | MyApp::Controller::Root | end | + '----------------------+--------------------------------------+--------------' + + [info] MyApp powered by Catalyst 5.7002 + You can connect to your server at http://localhost:3000 -Though it's obviously too early for any significant celebration, we already have a functioning application. Run the following command to run this application with the built-in development web server: +B: Be sure you run the C