X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F02_CatalystBasics.pod;h=2319bea339e4014ac7f127ab78d582c7ed4d8698;hp=3808ec05921e800e4ac3ab4f5124e42537479244;hb=608ea8afc33ba2fd406e19111720fac2cfe7ce39;hpb=6bd343899559c5504700854f7c9f607eea8c686a diff --git a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod index 3808ec0..2319bea 100644 --- a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod @@ -74,7 +74,7 @@ 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: +L). In short: =over 4 @@ -110,7 +110,7 @@ automatically create our Catalyst model for use with a database. You can checkout the source code for this example from the catalyst subversion repository as per the instructions in -L. +L. =head1 CREATE A CATALYST PROJECT @@ -118,10 +118,10 @@ L. 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). +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. +scripts unless you install both L +and L. In this first chapter of the tutorial, use the Catalyst C script to initialize the framework for an application called C: @@ -200,13 +200,13 @@ C to breakout of the dev server) if you prefer. [debug] Statistics enabled [debug] Loaded plugins: .----------------------------------------------------------------------------. - | Catalyst::Plugin::ConfigLoader 0.27 | + | Catalyst::Plugin::ConfigLoader 0.30 | '----------------------------------------------------------------------------' [debug] Loaded dispatcher "Catalyst::Dispatcher" - [debug] Loaded engine "Catalyst::Engine::HTTP" - [debug] Found home "/home/me/Hello" - [debug] Loaded Config "/home/me/Hello/hello.conf" + [debug] Loaded engine "Catalyst::Engine" + [debug] Found home "/home/catalyst/Hello" + [debug] Loaded Config "/home/catalyst/Hello/hello.conf" [debug] Loaded components: .-----------------------------------------------------------------+----------. | Class | Type | @@ -231,8 +231,8 @@ C to breakout of the dev server) if you prefer. | / | /default | '-------------------------------------+--------------------------------------' - [info] Hello powered by Catalyst 5.80025 - You can connect to your server at http://debian:3000 + [info] Hello powered by Catalyst 5.90002 + HTTP::Server::PSGI: Accepting connections at http://0:3000/ Point your web browser to L (substituting a different hostname or IP address as appropriate) and you should be @@ -241,15 +241,18 @@ screen or an "Index" screen, you probably forgot to specify port 3000 in your URL). Information similar to the following should be appended to the logging output of the development server: - [info] *** Request 1 (0.001/s) [23194] [Sat Jan 16 11:09:18 2010] *** - [debug] "GET" request for "/" from "127.0.0.1" + [info] Hello powered by Catalyst 5.90002 + HTTP::Server::PSGI: Accepting connections at http://0:3000/ + [info] *** Request 1 (0.067/s) [19026] [Tue Aug 30 17:24:32 2011] *** + [debug] "GET" request for "/" from "192.168.245.2" [debug] Path is "/" - [info] Request took 0.004851s (206.143/s) + [debug] Response Code: 200; Content-Type: text/html; charset=utf-8; Content-Length: 5613 + [info] Request took 0.040895s (24.453/s) .------------------------------------------------------------+-----------. | Action | Time | +------------------------------------------------------------+-----------+ - | /index | 0.000395s | - | /end | 0.000425s | + | /index | 0.000916s | + | /end | 0.000877s | '------------------------------------------------------------+-----------' B: Press C to break out of the development server if @@ -268,7 +271,7 @@ browser. sub index :Path :Args(0) { my ( $self, $c ) = @_; - + # Hello World $c->response->body( $c->welcome_message ); } @@ -279,11 +282,11 @@ as a "404" message or a redirect, but for now just leave it alone. The "C<$c>" here refers to the Catalyst context, which is used to access the Catalyst application. In addition to many other things, the Catalyst context provides access to "response" and "request" objects. (See -L, L, and -L) +L, L, and +L) C<$c-Eresponse-Ebody> sets the HTTP response (see -L), while +L), while C<$c-Ewelcome_message> is a special method that returns the welcome message that you saw in your browser. @@ -308,28 +311,25 @@ way. For example, the URL C maps to the package C, and the C method. -Add the following subroutine to your C -file: +While you leave the C