light Cookbook work
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Manual / Tutorial / CatalystBasics.pod
index e9b8818..43f6344 100644 (file)
@@ -715,7 +715,8 @@ context object in templates from its usual C<c> to C<Catalyst>. When
 looking at other Catalyst examples, remember that they almost always use
 C<c>.  Note that Catalyst and TT I<do not complain> when you use the
 wrong name to access the context object...TT simply outputs blanks for
-that bogus logic.  Finally, be aware that this change in name I<only>
+that bogus logic (see next tip to change this behavior with TT C<DEBUG>
+options).  Finally, be aware that this change in name I<only>
 applies to how the context object is accessed inside your TT templates;
 your controllers will continue to use C<$c> (or whatever name you use
 when fetching the reference from C<@_> inside your methods). (You can
@@ -725,6 +726,25 @@ C<root/lib/config/main> and C<root/lib/config/url>.  If you do this, be
 careful not to have a collision between your own C<c> variable and the
 Catalyst C<c> variable.)
 
+B<TIP>: When troubleshooting TT it can be helpful to enable variable
+C<DEBUG> options.  You can do this in a Catalyst environment by adding
+a C<DEBUG> line to the C<__PACKAGE__->config> declaration in 
+C<MyApp/View/TT.pm>:
+
+    __PACKAGE__->config({
+        CATALYST_VAR => 'Catalyst',
+        ...
+        DEBUG        => 'undef',
+        ...
+    });
+   
+There are a variety of options you can use, such as 'undef', 'all', 
+'service', 'context', 'parser', 'provider', and 'service'.  See
+L<Template::Constants> for more information (remove the C<DEBUG_>
+portion of the name shown in the TT docs and convert to lower case
+for use inside Catalyst).
+
+
 =head2 Globally Customize Every View
 
 When using TTSite, files in the subdirectories of C<root/lib> can be
@@ -786,10 +806,10 @@ Then open C<root/src/books/list.tt2> in your editor and enter:
         <td>
           [% # First initialize a TT variable to hold a list.  Then use a TT FOREACH -%]
           [% # loop in 'side effect notation' to load just the last names of the     -%]
-          [% # authors into the list.  Note that we are making a bogus assignment to -%]
-          [% # the 'xx' vbl to avoid printing the size of the list after each push.  -%]      
+          [% # authors into the list.  Note that we make a bogus assignment to the   -%]
+          [% # 'unused' vbl to avoid printing the size of the list after each push.  -%]      
           [% tt_authors = [ ];
-             xx = tt_authors.push(author.last_name) FOREACH author = book.authors %]
+             unused = tt_authors.push(author.last_name) FOREACH author = book.authors %]
           [% # Now use a TT 'virtual method' to display the author count in parens   -%]
           ([% tt_authors.size %])
           [% # Use another vmethod to join & print the names with comma separators   -%]