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=7184a7e3cf90c84a5cd1888280255a9380524082;hp=29b4f29625e1c636767b50004412ce1266b30342;hb=HEAD;hpb=b6e618b83482f9ec4e6d805067a3dff7e9d3a3cb diff --git a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod index 29b4f29..7184a7e 100644 --- a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod @@ -117,13 +117,13 @@ 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 +begin with the F 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 this first chapter of the tutorial, use the Catalyst C +In this first chapter of the tutorial, use the Catalyst F script to initialize the framework for an application called C: $ catalyst.pl Hello @@ -140,13 +140,13 @@ Note: If you are using Strawberry Perl on Win32, drop the ".pl" from the end of the "catalyst.pl" command and simply use "catalyst Hello". -The C helper script will display the names of the +The F helper script will display the names of the directories and files it creates: Changes # Record of application changes lib # Lib directory for your app's Perl modules Hello # Application main code directory - Controller # Directory for Controller modules + Controller # Directory for Controller modules Model # Directory for Models View # Directory for Views Hello.pm # Base application module @@ -164,13 +164,13 @@ directories and files it creates: hello_server.pl # The normal development server hello_test.pl # Test your app from the command line t # Directory for tests - 01app.t # Test scaffold - 02pod.t - 03podcoverage.t + 01app.t # Test scaffold + 02pod.t + 03podcoverage.t Catalyst will "auto-discover" modules in the Controller, Model, and View -directories. When you use the C script it will create Perl +directories. When you use the F script it will create Perl module scaffolds in those directories, plus test files in the "t" directory. The default location for templates is in the "root" directory. The scripts in the script directory will always start with @@ -202,18 +202,18 @@ C to breakout of the dev server) if you prefer. .----------------------------------------------------------------------------. | Catalyst::Plugin::ConfigLoader 0.30 | '----------------------------------------------------------------------------' - + [debug] Loaded dispatcher "Catalyst::Dispatcher" [debug] Loaded engine "Catalyst::Engine" - [debug] Found home "/root/Hello" - [debug] Loaded Config "/root/Hello/hello.conf" + [debug] Found home "/home/catalyst/Hello" + [debug] Loaded Config "/home/catalyst/Hello/hello.conf" [debug] Loaded components: .-----------------------------------------------------------------+----------. | Class | Type | +-----------------------------------------------------------------+----------+ | Hello::Controller::Root | instance | '-----------------------------------------------------------------+----------' - + [debug] Loaded Private actions: .----------------------+--------------------------------------+--------------. | Private | Class | Method | @@ -222,7 +222,7 @@ C to breakout of the dev server) if you prefer. | /end | Hello::Controller::Root | end | | /index | Hello::Controller::Root | index | '----------------------+--------------------------------------+--------------' - + [debug] Loaded Path actions: .-------------------------------------+--------------------------------------. | Path | Private | @@ -230,7 +230,7 @@ C to breakout of the dev server) if you prefer. | / | /index | | / | /default | '-------------------------------------+--------------------------------------' - + [info] Hello powered by Catalyst 5.90002 HTTP::Server::PSGI: Accepting connections at http://0:3000/ @@ -264,14 +264,14 @@ necessary. =head2 The Simplest Way The Root.pm controller is a place to put global actions that usually -execute on the root URL. Open the C file +execute on the root URL. Open the F file in your editor. You will see the "index" subroutine, which is responsible for displaying the welcome screen that you just saw in your browser. sub index :Path :Args(0) { my ( $self, $c ) = @_; - + # Hello World $c->response->body( $c->welcome_message ); } @@ -282,15 +282,15 @@ 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, and L) -C<$c-Eresponse-Ebody> sets the HTTP response (see +C<< $c->response->body >> sets the HTTP response (see L), while -C<$c-Ewelcome_message> is a special method that returns the welcome +C<< $c->welcome_message >> is a special method that returns the welcome message that you saw in your browser. -The ":Path :Args(0)" after the method name are attributes which +The "C<:Path :Args(0)>" after the method name are attributes which determine which URLs will be dispatched to this method. (You might see ":Private" if you are using an older version of Catalyst, but using that with "default" or "index" is currently deprecated. If so, you should @@ -301,7 +301,7 @@ policy, prefers to handle URL dispatching with attributes on controller methods. There is a lot of flexibility in specifying which URLs to match. This particular method will match all URLs, because it doesn't specify the path (nothing comes after "Path"), but will only accept a -URL without any args because of the ":Args(0)". +URL without any args because of the "C<:Args(0)>". The default is to map URLs to controller names, and because of the way that Perl handles namespaces through package names, it is simple to @@ -312,13 +312,13 @@ to the package C, and the C method. While you leave the C