From: Kennedy Clark Date: Tue, 16 Feb 2010 19:37:18 +0000 (+0000) Subject: Move mention of different "stash styles" to Ch2 X-Git-Tag: v5.8005~41 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=ddfbd8506f744fe1dc407bdaa7a1e9211b2dd1d7 Move mention of different "stash styles" to Ch2 Switch to consistent attribute style (":Name" vs. ": Name") as per changes started in early chapters --- diff --git a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod index 0156f2b..dde6b86 100644 --- a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod @@ -442,6 +442,27 @@ 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 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 diff --git a/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod index a8cf80e..e8da3f6 100644 --- a/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod @@ -1547,7 +1547,7 @@ has changed): =cut - sub list : Local { + sub list :Local { # Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst # 'Context' that's used to 'glue together' the various components # that make up the application diff --git a/lib/Catalyst/Manual/Tutorial/05_Authentication.pod b/lib/Catalyst/Manual/Tutorial/05_Authentication.pod index 5f378cc..358c398 100644 --- a/lib/Catalyst/Manual/Tutorial/05_Authentication.pod +++ b/lib/Catalyst/Manual/Tutorial/05_Authentication.pod @@ -465,7 +465,7 @@ the following method: # Note that 'auto' runs after 'begin' but before your actions and that # 'auto's "chain" (all from application path to most specific class are run) # See the 'Actions' section of 'Catalyst::Manual::Intro' for more info. - sub auto : Private { + sub auto :Private { my ($self, $c) = @_; # Allow unauthenticated users to reach the login page. This diff --git a/lib/Catalyst/Manual/Tutorial/07_Debugging.pod b/lib/Catalyst/Manual/Tutorial/07_Debugging.pod index 1644a85..0ca6d5d 100644 --- a/lib/Catalyst/Manual/Tutorial/07_Debugging.pod +++ b/lib/Catalyst/Manual/Tutorial/07_Debugging.pod @@ -118,7 +118,7 @@ C line as follows inside the C method (I like to "left-justify" my debug statements so I don't forget to remove them, but you can obviously indent them if you prefer): - sub list : Local { + sub list :Local { # Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst # 'Context' that's used to 'glue together' the various components # that make up the application