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=28f3ab0a1b15d248888d7fc2a4af384ca7d9d400;hp=0156f2b46713d64f0b62057c50cc0f9495e1481f;hb=af0a93cff5b96bfce3983b6ca99efce2145d5912;hpb=7a296c6f6dd11310f3d9b2295f151795241a3fcb diff --git a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod index 0156f2b..28f3ab0 100644 --- a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod @@ -330,7 +330,7 @@ Save the file, and you should notice the following in your server output: - /home/me/Hello/lib/Hello/Controller/Root.pm (modify) Attempting to restart the server - ... + ... [debug] Loaded Private actions: .----------------------+--------------------------------------+--------------. | Private | Class | Method | @@ -407,7 +407,7 @@ chapters of the tutorial). Create a C template file (put it in the C under the C directory that is the base of your application). Here is a simple sample: - +

This is a TT view template, called '[% template.name %]'.

@@ -442,6 +442,32 @@ using the "-r" option -- manually restart it if you aren't), and look at L in your again. You should see the template that you just made. +B If you keep the server running with "-r" in a "background +window," don't let that window get totally hidden... if you have an +syntax error in your code, the debug server output will contain the +error information. + +B You will probably run into a variation of the "stash" +statement above that looks like: + + $c->stash->{template} = 'hello.tt'; + +Although this style is still relatively common, the approach we +used previous is becoming more common because it allows you to +set multiple stash variables in one line. For example: + + $c->stash(template => 'hello.tt', foo => 'bar', + another_thing => 1); + +You can also set multiple stash values with a hashref: + + $c->stash({template => 'hello.tt', foo => 'bar', + another_thing => 1}); + +Any of these formats work, but the C<$c-Estash(name =E value);> +style is growing in popularity -- you may wish to use it all the +time (even when you are only setting a single value). + =head1 CREATE A SIMPLE CONTROLLER AND AN ACTION @@ -459,7 +485,7 @@ In C, add the following method: my ( $self, $c ) = @_; $c->stash(username => 'John', - template => 'site/test.tt'); + template => 'site/test.tt'); } Notice the "Local" attribute on the C method. This will cause