Move mention of different "stash styles" to Ch2
Kennedy Clark [Tue, 16 Feb 2010 19:37:18 +0000 (19:37 +0000)]
Switch to consistent attribute style (":Name" vs. ": Name") as per changes started in early chapters

lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod
lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod
lib/Catalyst/Manual/Tutorial/05_Authentication.pod
lib/Catalyst/Manual/Tutorial/07_Debugging.pod

index 0156f2b..dde6b86 100644 (file)
@@ -442,6 +442,27 @@ using the "-r" option -- manually restart it if you aren't),
 and look at L<http://localhost:3000/hello> in your again. You 
 should see the template that you just made.
 
+B<Note:> 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-E<gt>stash(name =E<gt> 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
 
index a8cf80e..e8da3f6 100644 (file)
@@ -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
index 5f378cc..358c398 100644 (file)
@@ -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
index 1644a85..0ca6d5d 100644 (file)
@@ -118,7 +118,7 @@ C<DB::single=1> line as follows inside the C<list> 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