[Catalyst-commits] r8067 - in trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial: . AdvancedCRUD

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Tue Jul 1 12:13:32 BST 2008


Author: t0m
Date: 2008-07-01 12:13:32 +0100 (Tue, 01 Jul 2008)
New Revision: 8067

Modified:
   trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod
   trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Authentication.pod
   trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Authorization.pod
   trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod
   trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Debugging.pod
   trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod
Log:
Apply patch from Adrian Lai to clean up a few out of date bits in the tutorials

Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod	2008-07-01 06:18:50 UTC (rev 8066)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod	2008-07-01 11:13:32 UTC (rev 8067)
@@ -239,7 +239,7 @@
     [%# Render the HTML::FormFu Form %]
     [% form %]
     
-    <p><a href="[% Catalyst.uri_for('list') %]">Return to book list</a></p>
+    <p><a href="[% c.uri_for('list') %]">Return to book list</a></p>
 
 
 =head2 Add Links for Create and Update via C<HTML::FormFu>
@@ -249,7 +249,7 @@
 
     <p>
       HTML::FormFu:
-      <a href="[% Catalyst.uri_for('formfu_create') %]">Create</a>
+      <a href="[% c.uri_for('formfu_create') %]">Create</a>
     </p>
 
 This adds a new link to the bottom of the book list page that we can
@@ -532,9 +532,9 @@
 
     <td>
       [% # Add a link to delete a book %]
-      <a href="[% Catalyst.uri_for('delete', book.id) %]">Delete</a>
+      <a href="[% c.uri_for('delete', book.id) %]">Delete</a>
       [% # Add a link to edit a book %]
-      <a href="[% Catalyst.uri_for('formfu_edit', book.id) %]">Edit</a>
+      <a href="[% c.uri_for('formfu_edit', book.id) %]">Edit</a>
     </td>
 
 

Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Authentication.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Authentication.pod	2008-07-01 06:18:50 UTC (rev 8066)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Authentication.pod	2008-07-01 11:13:32 UTC (rev 8067)
@@ -247,7 +247,7 @@
 Edit C<lib/MyApp.pm> and update it as follows (everything below
 C<StackTrace> is new):
 
-    use Catalyst qw/
+    __PACKAGE__->setup(qw/
             -Debug
             ConfigLoader
             Static::Simple
@@ -259,7 +259,7 @@
             Session
             Session::Store::FastMmap
             Session::State::Cookie
-            /;
+            /);
 
 The C<Authentication> plugin supports Authentication while the
 C<Session> plugins are required to maintain state across multiple HTTP
@@ -453,7 +453,7 @@
     [% META title = 'Login' %]
 
     <!-- Login form -->
-    <form method="post" action="[% Catalyst.uri_for('/login') %]">
+    <form method="post" action="[% c.uri_for('/login') %]">
       <table>
         <tr>
           <td>Username:</td>
@@ -589,9 +589,9 @@
        # This code illustrates how certain parts of the TT
        # template will only be shown to users who have logged in
     %]
-    [% IF Catalyst.user_exists %]
-        Please Note: You are already logged in as '[% Catalyst.user.username %]'.
-        You can <a href="[% Catalyst.uri_for('/logout') %]">logout</a> here.
+    [% IF c.user_exists %]
+        Please Note: You are already logged in as '[% c.user.username %]'.
+        You can <a href="[% c.uri_for('/logout') %]">logout</a> here.
     [% ELSE %]
         You need to log in to use this application.
     [% END %]
@@ -638,8 +638,8 @@
 bottom (below the closing </table> tag):
 
     <p>
-      <a href="[% Catalyst.uri_for('/login') %]">Login</a>
-      <a href="[% Catalyst.uri_for('form_create') %]">Create</a>
+      <a href="[% c.uri_for('/login') %]">Login</a>
+      <a href="[% c.uri_for('form_create') %]">Create</a>
     </p>
 
 Reload your browser and you should now see a "Login" and "Create" links
@@ -813,7 +813,7 @@
     <div id="header">[% PROCESS site/header %]</div>
 
     <div id="content">
-    <span class="message">[% status_msg || Catalyst.flash.status_msg %]</span>
+    <span class="message">[% status_msg || c.flash.status_msg %]</span>
     <span class="error">[% error_msg %]</span>
     [% content %]
     </div>
@@ -841,7 +841,7 @@
 
 Although the a use of flash above is certainly an improvement over the
 C<status_msg> we employed in Part 4 of the tutorial, the C<status_msg
-|| Catalyst.flash.status_msg> statement is a little ugly. A nice
+|| c.flash.status_msg> statement is a little ugly. A nice
 alternative is to use the C<flash_to_stash> feature that automatically
 copies the content of flash to stash.  This makes your code controller
 and template code work regardless of where it was directly access, a
@@ -873,7 +873,7 @@
 L<http://localhost:3000/books/list> in your browser.  Delete another
 of the "Test" books you added in the previous step.  Flash should still
 maintain the status message across the redirect even though you are no
-longer explicitly accessing C<Catalyst.flash>.
+longer explicitly accessing C<c.flash>.
 
 
 =head1 AUTHOR

Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Authorization.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Authorization.pod	2008-07-01 06:18:50 UTC (rev 8066)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Authorization.pod	2008-07-01 11:13:32 UTC (rev 8067)
@@ -74,7 +74,7 @@
 
 Edit C<lib/MyApp.pm> and add C<Authorization::Roles> to the list:
 
-    use Catalyst qw/
+    __PACKAGE__->setup(qw/
             -Debug
             ConfigLoader
             Static::Simple
@@ -87,7 +87,7 @@
             Session
             Session::Store::FastMmap
             Session::State::Cookie
-            /;
+            /);
 
 
 =head2 Add Config Information for Authorization
@@ -145,25 +145,25 @@
 Open C<root/src/books/list.tt2> in your editor and add the following
 lines to the bottom of the file:
 
-    <p>Hello [% Catalyst.user.username %], you have the following roles:</p>
+    <p>Hello [% c.user.username %], you have the following roles:</p>
 
     <ul>
       [% # Dump list of roles -%]
-      [% FOR role = Catalyst.user.roles %]<li>[% role %]</li>[% END %]
+      [% FOR role = c.user.roles %]<li>[% role %]</li>[% END %]
     </ul>
 
     <p>
     [% # Add some simple role-specific logic to template %]
     [% # Use $c->check_user_roles() to check authz -%]
-    [% IF Catalyst.check_user_roles('user') %]
+    [% IF c.check_user_roles('user') %]
       [% # Give normal users a link for 'logout' %]
-      <a href="[% Catalyst.uri_for('/logout') %]">Logout</a>
+      <a href="[% c.uri_for('/logout') %]">Logout</a>
     [% END %]
 
     [% # Can also use $c->user->check_roles() to check authz -%]
-    [% IF Catalyst.check_user_roles('admin') %]
+    [% IF c.check_user_roles('admin') %]
       [% # Give admin users a link for 'create' %]
-      <a href="[% Catalyst.uri_for('form_create') %]">Create</a>
+      <a href="[% c.uri_for('form_create') %]">Create</a>
     [% END %]
     </p>
 

Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod	2008-07-01 06:18:50 UTC (rev 8066)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod	2008-07-01 11:13:32 UTC (rev 8067)
@@ -164,7 +164,7 @@
     
     [% # Provide a link back to the list page                                    -%]
     [% # 'uri_for()' builds a full URI; e.g., 'http://localhost:3000/books/list' -%]
-    <p><a href="[% Catalyst.uri_for('/books/list') %]">Return to list</a></p>
+    <p><a href="[% c.uri_for('/books/list') %]">Return to list</a></p>
     
     [% # Try out the TT Dumper (for development only!) -%]
     <pre>
@@ -266,7 +266,7 @@
 
     [% META title = 'Manual Form Book Create' -%]
     
-    <form method="post" action="[% Catalyst.uri_for('form_create_do') %]">
+    <form method="post" action="[% c.uri_for('form_create_do') %]">
     <table>
       <tr><td>Title:</td><td><input type="text" name="title"></td></tr>
       <tr><td>Rating:</td><td><input type="text" name="rating"></td></tr>
@@ -380,7 +380,7 @@
         </td>
         <td>
           [% # Add a link to delete a book %]
-          <a href="[% Catalyst.uri_for('delete', book.id) %]">Delete</a>
+          <a href="[% c.uri_for('delete', book.id) %]">Delete</a>
         </td>
       </tr>
     [% END -%]
@@ -536,7 +536,7 @@
     <div id="header">[% PROCESS site/header %]</div>
     
     <div id="content">
-    <span class="message">[% status_msg || Catalyst.request.params.status_msg %]</span>
+    <span class="message">[% status_msg || c.request.params.status_msg %]</span>
     <span class="error">[% error_msg %]</span>
     [% content %]
     </div>

Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Debugging.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Debugging.pod	2008-07-01 06:18:50 UTC (rev 8066)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/Debugging.pod	2008-07-01 11:13:32 UTC (rev 8067)
@@ -90,7 +90,7 @@
 with the other debug output. To accomplish the same thing in a TTSite
 view use:
 
-    [% Catalyst.log.debug("This is a test log message") %]
+    [% c.log.debug("This is a test log message") %]
 
 You can also use L<Data::Dumper|Data::Dumper> in both Catalyst code 
 (C<use Data::Dumper; $c-E<gt>log-E<gt>debug("\$var is: ".Dumper($var));)>) 

Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod	2008-07-01 06:18:50 UTC (rev 8066)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod	2008-07-01 11:13:32 UTC (rev 8067)
@@ -87,7 +87,7 @@
     $ cd MyApp
 
 This creates a similar skeletal structure to what we saw in Part 2 of 
-the tutorial, except with C<MyApp> or C<myapp> substituted for 
+the tutorial, except with C<MyApp> and C<myapp> substituted for 
 C<Hello> and C<hello>.
 
 
@@ -181,17 +181,17 @@
 generally referred to as your I<application class>) and delete the line
 with:
 
-    use Catalyst qw/-Debug ConfigLoader Static::Simple/;
+    __PACKAGE__->setup(qw/-Debug ConfigLoader Static::Simple/);
 
 Replace it with:
 
-    use Catalyst qw/
+    __PACKAGE__->setup(qw/
             -Debug
             ConfigLoader
             Static::Simple
             
             StackTrace
-            /;
+            /);
 
 This tells Catalyst to start using one new plugin:
 
@@ -361,30 +361,12 @@
 application.  Also take a look at C<lib/MyApp/View/TT.pm> for config
 values set by the C<TTSite> helper.
 
-B<TIP>: Note that TTSite does one thing that could confuse people who
-are used to the normal C<TT> Catalyst view: it redefines the Catalyst
-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 (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
-change back to the "default" behavior be removing the C<CATALYST_VAR>
-line from C<lib/MyApp/View/TT.pm>, but you will also have to edit
-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<lib/MyApp/View/TT.pm>:
 
     __PACKAGE__->config({
-        CATALYST_VAR => 'Catalyst',
         ...
         DEBUG        => 'undef',
         ...




More information about the Catalyst-commits mailing list