From: Tomas Doran Date: Tue, 1 Jul 2008 11:13:32 +0000 (+0000) Subject: Apply patch from Adrian Lai to clean up a few out of date bits in the tutorials X-Git-Tag: v5.8005~274 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=8a7c51514fe8828c25ecd353ad2e9dc3b456ac9a;hp=905a3a26761669e7c4fd80daa50034eaa3375b50 Apply patch from Adrian Lai to clean up a few out of date bits in the tutorials --- diff --git a/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod b/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod index 98dd487..6cb247a 100644 --- a/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod +++ b/lib/Catalyst/Manual/Tutorial/AdvancedCRUD/FormFu.pod @@ -239,7 +239,7 @@ Open C in your editor and enter the following: [%# Render the HTML::FormFu Form %] [% form %] -

Return to book list

+

Return to book list

=head2 Add Links for Create and Update via C @@ -249,7 +249,7 @@ the bottom of the existing file:

HTML::FormFu: - Create + Create

This adds a new link to the bottom of the book list page that we can @@ -532,9 +532,9 @@ following: [% # Add a link to delete a book %] - Delete + Delete [% # Add a link to edit a book %] - Edit + Edit diff --git a/lib/Catalyst/Manual/Tutorial/Authentication.pod b/lib/Catalyst/Manual/Tutorial/Authentication.pod index e66fee8..f32e05b 100644 --- a/lib/Catalyst/Manual/Tutorial/Authentication.pod +++ b/lib/Catalyst/Manual/Tutorial/Authentication.pod @@ -247,7 +247,7 @@ by Catalyst under C. Edit C and update it as follows (everything below C is new): - use Catalyst qw/ + __PACKAGE__->setup(qw/ -Debug ConfigLoader Static::Simple @@ -259,7 +259,7 @@ C is new): Session Session::Store::FastMmap Session::State::Cookie - /; + /); The C plugin supports Authentication while the C plugins are required to maintain state across multiple HTTP @@ -453,7 +453,7 @@ Create a login form by opening C and inserting: [% META title = 'Login' %] -
+ @@ -589,9 +589,9 @@ lines to the bottom of the file: # 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 logout here. + [% IF c.user_exists %] + Please Note: You are already logged in as '[% c.user.username %]'. + You can logout here. [% ELSE %] You need to log in to use this application. [% END %] @@ -638,8 +638,8 @@ Open C and add the following lines to the bottom (below the closing
Username:
tag):

- Login - Create + Login + Create

Reload your browser and you should now see a "Login" and "Create" links @@ -813,7 +813,7 @@ flash vs. the C query parameter:
- [% status_msg || Catalyst.flash.status_msg %] + [% status_msg || c.flash.status_msg %] [% error_msg %] [% content %]
@@ -841,7 +841,7 @@ information. Although the a use of flash above is certainly an improvement over the C we employed in Part 4 of the tutorial, the C statement is a little ugly. A nice +|| c.flash.status_msg> statement is a little ugly. A nice alternative is to use the C 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 @@ Restart the development server and go to L 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. +longer explicitly accessing C. =head1 AUTHOR diff --git a/lib/Catalyst/Manual/Tutorial/Authorization.pod b/lib/Catalyst/Manual/Tutorial/Authorization.pod index f889bde..14d62b0 100644 --- a/lib/Catalyst/Manual/Tutorial/Authorization.pod +++ b/lib/Catalyst/Manual/Tutorial/Authorization.pod @@ -74,7 +74,7 @@ In this section you learn how to manually configure authorization. Edit C and add C to the list: - use Catalyst qw/ + __PACKAGE__->setup(qw/ -Debug ConfigLoader Static::Simple @@ -87,7 +87,7 @@ Edit C and add C to the list: Session Session::Store::FastMmap Session::State::Cookie - /; + /); =head2 Add Config Information for Authorization @@ -145,25 +145,25 @@ C and C definitions are new): Open C in your editor and add the following lines to the bottom of the file: -

Hello [% Catalyst.user.username %], you have the following roles:

+

Hello [% c.user.username %], you have the following roles:

    [% # Dump list of roles -%] - [% FOR role = Catalyst.user.roles %]
  • [% role %]
  • [% END %] + [% FOR role = c.user.roles %]
  • [% role %]
  • [% END %]

[% # 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' %] - Logout + Logout [% 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' %] - Create + Create [% END %]

diff --git a/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod b/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod index dcc3ade..7da68dc 100644 --- a/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod +++ b/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod @@ -164,7 +164,7 @@ Edit C and then enter: [% # Provide a link back to the list page -%] [% # 'uri_for()' builds a full URI; e.g., 'http://localhost:3000/books/list' -%] -

Return to list

+

Return to list

[% # Try out the TT Dumper (for development only!) -%]
@@ -266,7 +266,7 @@ Open C in your editor and enter:
 
     [% META title = 'Manual Form Book Create' -%]
     
-    
+    
     
@@ -380,7 +380,7 @@ and 2) the four lines for the Delete link near the bottom).
         
     [% END -%]
@@ -536,7 +536,7 @@ query parameter:
     
- [% status_msg || Catalyst.request.params.status_msg %] + [% status_msg || c.request.params.status_msg %] [% error_msg %] [% content %]
diff --git a/lib/Catalyst/Manual/Tutorial/Debugging.pod b/lib/Catalyst/Manual/Tutorial/Debugging.pod index 91ecb5a..125bc3d 100644 --- a/lib/Catalyst/Manual/Tutorial/Debugging.pod +++ b/lib/Catalyst/Manual/Tutorial/Debugging.pod @@ -90,7 +90,7 @@ Then the Catalyst development server will display your message along 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 in both Catalyst code (Clog-Edebug("\$var is: ".Dumper($var));)>) diff --git a/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod index cf413cd..aa66e12 100644 --- a/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod @@ -87,7 +87,7 @@ tutorial): $ cd MyApp This creates a similar skeletal structure to what we saw in Part 2 of -the tutorial, except with C or C substituted for +the tutorial, except with C and C substituted for C and C. @@ -181,17 +181,17 @@ To modify the list of plugins, edit C (this file is generally referred to as your I) 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 @@ directories that can be used to customize the look and feel of your application. Also take a look at C for config values set by the C helper. -B: Note that TTSite does one thing that could confuse people who -are used to the normal C Catalyst view: it redefines the Catalyst -context object in templates from its usual C to C. When -looking at other Catalyst examples, remember that they almost always use -C. Note that Catalyst and TT I 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 -options). Finally, be aware that this change in name I -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 -line from C, but you will also have to edit -C and C. If you do this, be -careful not to have a collision between your own C variable and the -Catalyst C variable.) - B: When troubleshooting TT it can be helpful to enable variable C options. You can do this in a Catalyst environment by adding a C line to the C<__PACKAGE__->config> declaration in C: __PACKAGE__->config({ - CATALYST_VAR => 'Catalyst', ... DEBUG => 'undef', ...
Title:
Rating:
[% # Add a link to delete a book %] - Delete + Delete