X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FCatalystBasics.pod;h=98b18c69359498f07a97cfad224092d0d0ce6687;hp=2d7eb7b310e6465a57cf60c13a50ab84d82cec83;hb=9555f8ab5a549e3949a141233b1ad35adc0f742d;hpb=d04961970a25ec3dc831f89be5cd6e27fdec884a diff --git a/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod index 2d7eb7b..98b18c6 100644 --- a/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod @@ -242,7 +242,7 @@ responsible for displaying the welcome screen that you just saw in your browser. Later on you'll want to change that to something more reasonable, such as a "404" message but for now just leave it alone. - sub default : Path : Args { + sub default :Path :Args { my ( $self, $c ) = @_; $c->response->body( $c->welcome_message ); @@ -255,12 +255,12 @@ objects. (See L, L, and L) -C<$c->response->body> sets the HTTP response (see -L), while C<$c->welcome_message> +C<$c-Eresponse-Ebody> sets the HTTP response (see +L), while C<$c-Ewelcome_message> is a special method that returns the welcome message that you saw in your browser. -The ": Path : Args" after the method name are attributes which determine +The ":Path :Args" after the method name are attributes which determine which URLs will be dispatched to this method. (Depending on your version of Catalyst, it used to say "Private" but using that with default is currently deprecated.) @@ -312,8 +312,8 @@ To create a TT view, run: This creates the C module, which is a subclass of C. The "view" keyword tells the create script that -you are creating a view, the first "TT" tells it that you are creating -a Template Toolkit view, and the second "TT" tells the script to name +you are creating a view, the second "TT" tells it that you are creating +a Template Toolkit view, and the first "TT" tells the script to name the View module "TT.pm", which is a commonly used name for TT views. (You can name it anything you want, such as "HTML.pm".) If you look at TT.pm, you will find that it only contains a config statement to set @@ -325,7 +325,7 @@ method that it inherits from the C. Template Toolkit is a very full featured template facility, with excellent documentation at -L, +L, but since this is not a TT tutorial, we'll stick to only basic TT usage here (and explore some of the more common TT features in later parts of the tutorial). @@ -350,13 +350,13 @@ C to the following: $c->stash->{template} = 'hello.tt'; } -This time, instead of doing C<$c->response->body()>, you are setting +This time, instead of doing C<$c-Eresponse->body()>, you are setting the value of the "template" hash key in the Catalyst "stash", an area for putting information to share with other parts of your application. The "template" key determines which template will be displayed at the end of the method. Catalyst controllers have a default "end" action for all methods which causes the first (or default) view to be -rendered (unless there's a C<$c->response->body()> statement). So your +rendered (unless there's a C<$c-Eresponse->body()> statement). So your template will be magically displayed at the end of your method. After saving the file, restart the development server, and look at @@ -418,5 +418,5 @@ Please report any errors, issues or suggestions to the author. The most recent version of the Catalyst Tutorial can be found at L. -Copyright 2006, Kennedy Clark & Gerda Shank, under Creative Commons License +Copyright 2006-2008, Kennedy Clark & Gerda Shank, under Creative Commons License (L).