Fix TT 2.15 issue in BasicCRUD.
Kennedy Clark [Fri, 7 Jul 2006 19:43:25 +0000 (19:43 +0000)]
Add regex test case to Testing.
Run spellcheck.
Fix typo in footer.
Update svn checkout commands to use tags.
Add redisplay of cleared form in last section of Advanced CRUD.
Fix POD for Login & Logout.
Update screenshot of dev svr log output.
Misc small fixes.

lib/Catalyst/Manual/Installation/CentOS4.pod
lib/Catalyst/Manual/Tutorial.pod
lib/Catalyst/Manual/Tutorial/AdvancedCRUD.pod
lib/Catalyst/Manual/Tutorial/Appendices.pod
lib/Catalyst/Manual/Tutorial/Authentication.pod
lib/Catalyst/Manual/Tutorial/Authorization.pod
lib/Catalyst/Manual/Tutorial/BasicCRUD.pod
lib/Catalyst/Manual/Tutorial/CatalystBasics.pod
lib/Catalyst/Manual/Tutorial/Debugging.pod
lib/Catalyst/Manual/Tutorial/Intro.pod
lib/Catalyst/Manual/Tutorial/Testing.pod

index e0619c8..03924ad 100644 (file)
@@ -229,7 +229,7 @@ and plugins required to run the Catalyst tutorial.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index 2a527ec..e9586db 100644 (file)
@@ -567,7 +567,7 @@ Bryan Roach.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index 6116797..6e157e0 100644 (file)
@@ -83,7 +83,7 @@ B<TIP>: Note that all of the code for this part of the tutorial can be
 pulled from the Catalyst Subversion repository in one step with the
 following command:
 
-    svn checkout http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial -r 4627 .
+    svn co http://dev.catalyst.perl.org/repos/Catalyst/tags/examples/Tutorial/MyApp/5.7/AdvancedCRUD MyApp
 
 =head1 C<HTML::WIDGET> FORM CREATION
 
@@ -130,11 +130,11 @@ following method:
         return $w;
     }
 
-This method provides a central location that builds an HTML::Widget-
-based form with the appropriate fields.  The "Get Authors" code uses 
-DBIC to retrieve a list of model objects and then uses C<map> to create 
-a hash where the hash keys are the database primary keys from the 
-authors table and the associated values are the last names of the 
+This method provides a central location that builds an 
+HTML::Widget-based form with the appropriate fields.  The "Get authors" 
+code uses DBIC to retrieve a list of model objects and then uses C<map> 
+to create a hash where the hash keys are the database primary keys from 
+the authors table and the associated values are the last names of the 
 authors.
 
 =head2 Add Actions to Display and Save the Form
@@ -544,6 +544,9 @@ match the following code:
     
             # Set a status message for the user
             $c->stash->{status_msg} = 'Book created';
+            
+            # Redisplay an empty form for another
+            $c->stash->{widget_result} = $w->result;
         }
     
         # Set the template
@@ -556,7 +559,12 @@ C<$c-E<gt>model('MyAppDB::Book')-E<gt>create> and replaced it with a
 single call to C<$book-E<gt>populate_from_widget>.  Note that we still
 have to call C<$book-E<gt>add_to_book_authors> once per author because
 C<populate_from_widget> does not currently handle the relationships
-between tables.
+between tables.  Also, we reset the form to an empty fields by adding
+another call to C<$w-E<gt>result> and storing the output in the stash 
+(if we don't override the output from C<$w-E<gt>process($c-E<gt>req)>,
+the form values already entered will be retained on redisplay --
+although this could be desirable for some applications, we avoid it
+here to help avoid the creation of duplicate records).
 
 
 =head2 Try Out the Form
@@ -575,7 +583,9 @@ you added should be visible.
 
 Some developers my wish to use the "old-fashioned" table style of 
 rendering a form in lieu of the default C<HTML::Widget> rendering that 
-assumes you will use CSS for formatting.
+assumes you will use CSS for formatting.  This section demonstrates
+some techniques that can override the default rendering with a 
+custom class.
 
 
 =head2 Add a New "Element Container"
@@ -720,7 +730,7 @@ the second field.
 
 =item *
 
-JavaScript to position the user's curson in the first field of the form.
+JavaScript to position the user's cursor in the first field of the form.
 
 =back
 
@@ -741,7 +751,7 @@ you added should be visible.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index efd4df0..00ae51b 100644 (file)
@@ -103,7 +103,7 @@ Removes four leading space from the current line through line 44
 
 =head2 "Un-indenting" with Emacs
 
-Although there author has not used emacs for many years (appologies to 
+Although there author has not used emacs for many years (apologies to 
 the emacs fans out there), here is a quick hint to get you started.  To
 replace the leading spaces of every line in a file, use:
 
@@ -466,7 +466,7 @@ not expose the passwords to "capture" on the command line.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index 0eac29c..5919ba9 100644 (file)
@@ -45,7 +45,7 @@ L<AdvancedCRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
 
 =item 9
 
-L<Appendices|Catalyst::Manual::Tutorial::Appendicies>
+L<Appendices|Catalyst::Manual::Tutorial::Appendices>
 
 =back
 
@@ -63,7 +63,7 @@ B<TIP>: Note that all of the code for this part of the tutorial can be
 pulled from the Catalyst Subversion repository in one step with the
 following command:
 
-    svn checkout http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial -r 4612 .
+    svn co http://dev.catalyst.perl.org/repos/Catalyst/tags/examples/Tutorial/MyApp/5.7/Authentication MyApp
 
 
 =head1 BASIC AUTHENTICATION
@@ -421,7 +421,7 @@ created the Login controller above), and delete this line:
 
 Then update it to match:
 
-    =head2 base
+    =head2 index
     
     Login logic
     
@@ -476,9 +476,10 @@ We make the match even more specific with the C<:Args(0)> action
 modifier -- this forces the match on I<only> C</login>, not 
 C</login/somethingelse>.
 
-Next, create a corresponding method in C<lib/MyApp/Controller/Logout.pm>:
+Next, update the corresponding method in C<lib/MyApp/Controller/Logout.pm>
+to match:
 
-    =head2 base
+    =head2 index
     
     Logout logic
     
@@ -789,7 +790,7 @@ of this module on your system:
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index 27f680a..7363a49 100644 (file)
@@ -63,7 +63,7 @@ B<TIP>: Note that all of the code for this part of the tutorial can be
 pulled from the Catalyst Subversion repository in one step with the
 following command:
 
-    svn checkout http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial -r 4613 .
+    svn co http://dev.catalyst.perl.org/repos/Catalyst/tags/examples/Tutorial/MyApp/5.7/Authorization MyApp
 
 
 =head1 BASIC AUTHORIZATION
@@ -406,7 +406,7 @@ L<http://localhost:3000/logout> URL directly) when you are done.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index 6c8e430..d6e0952 100644 (file)
@@ -45,7 +45,7 @@ L<AdvancedCRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
 
 =item 9
 
-L<Appendicies|Catalyst::Manual::Tutorial::Appendicies>
+L<Appendices|Catalyst::Manual::Tutorial::Appendices>
 
 =back
 
@@ -67,7 +67,7 @@ B<TIP>: Note that all of the code for this part of the tutorial can be
 pulled from the Catalyst Subversion repository in one step with the
 following command:
 
-    svn checkout http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial -r 4611 .
+    svn co http://dev.catalyst.perl.org/repos/Catalyst/tags/examples/Tutorial/5.7X/BasicCRUD MyApp
 
 
 =head1 FORMLESS SUBMISSION
@@ -146,13 +146,19 @@ Edit C<root/src/books/create_done.tt2> and then enter:
     [% # simple strings (e.g., no variable interpolation).                   -%]
     [% META title = 'Book Created' %]
     
-    [% # Output information about the record that was added.  Note use  -%]
-    [% # of 'first' to only list the first author (if > 1 author).  TT  -%] 
-    [% # v2.15 has an issue that requires                               -%]
-    [% # 'book.authors.list.first.value.last_name' vs. the shorter      -%]
-    [% # 'book.authors.first.last_name' in prior versions.              -%]
-    <p>Added book '[% book.title %]' 
-    by '[% book.authors.list.first.value.last_name %]'
+    [% # Output information about the record that was added.  First title.       -%]
+    <p>Added book '[% book.title %]'
+    
+    [% # Output the last name of the first author.  This is complicated by an    -%]
+    [% # issue in TT 2.15 where blessed hash objects are not handled right.      -%]
+    [% # First, fetch 'book.authors' from the DB once.                           -%]
+    [% authors = book.authors %]
+    [% # Now use IF statements to test if 'authors.first' is "working". If so,   -%]
+    [% # we use it.  Otherwise we use a hack that seems to keep TT 2.15 happy.   -%]
+    by '[% authors.first.last_name IF authors.first; 
+           authors.list.first.value.last_name IF ! authors.first %]'
+    
+    [% # Output the rating for the book that was added -%]
     with a rating of [% book.rating %].</p>
     
     [% # Provide a link back to the list page                                    -%]
@@ -257,7 +263,7 @@ C<form_create_do>, the method created in the section that follows.
 =head2 Add Method to Process Form Values and Update Database
 
 Edit C<lib/MyApp/Controller/Books.pm> and add the following method to
-save the form information to the databse:
+save the form information to the database:
 
     =head2 form_create_do
     
@@ -431,7 +437,7 @@ with a list of the six remaining books.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index 12bad6a..e944276 100644 (file)
@@ -45,7 +45,7 @@ L<Advanced CRUD|Catalyst::Manual::Tutorial::AdvancedCRUD>
 
 =item 9
 
-L<Appendices|Catalyst::Manual::Tutorial::Appendicies>
+L<Appendices|Catalyst::Manual::Tutorial::Appendices>
 
 =back
 
@@ -107,7 +107,7 @@ B<TIP>: Note that all of the code for this part of the tutorial can be
 pulled from the Catalyst Subversion repository in one step with the
 following command:
 
-    svn checkout http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial -r 4609 .
+    svn co http://dev.catalyst.perl.org/repos/Catalyst/tags/examples/Tutorial/MyApp/5.7/CatalystBasics MyApp
 
 
 =head1 CREATE A CATALYST PROJECT
@@ -170,14 +170,14 @@ greeted by the Catalyst welcome screen.  Information similar to the
 following should be appended to the logging output of the development 
 server:
 
-    [info] *** Request 1 (0.008/s) [2822] [Mon Jul  3 12:42:43 2006] ***
+    [info] *** Request 1 (0.043/s) [6003] [Fri Jul  7 13:32:53 2006] ***
     [debug] "GET" request for "/" from "127.0.0.1"
-    [info] Request took 0.154781s (6.461/s)
+    [info] Request took 0.067675s (14.777/s)
     .----------------------------------------------------------------+-----------.
     | Action                                                         | Time      |
     +----------------------------------------------------------------+-----------+
-    | /default                                                       | 0.069475s |
-    | /end                                                           | 0.085305s |
+    | /default                                                       | 0.002844s |
+    | /end                                                           | 0.000207s |
     '----------------------------------------------------------------+-----------'
 
 Press Ctrl-C to break out of the development server.
@@ -1129,7 +1129,7 @@ information for each book.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index 24815d6..5c4726d 100644 (file)
@@ -297,7 +297,7 @@ Otherwise, it returns undef and nothing will be printed.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index d06bd6a..7ef2d23 100644 (file)
@@ -324,7 +324,7 @@ L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/Final_Tarb
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License
index 0c74b32..0ff7916 100644 (file)
@@ -61,7 +61,7 @@ B<TIP>: Note that all of the code for this part of the tutorial can be
 pulled from the Catalyst Subversion repository in one step with the
 following command:
 
-    svn checkout http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial -r 4614 .
+    svn co http://dev.catalyst.perl.org/repos/Catalyst/tags/examples/Tutorial/MyApp/5.7/Testing MyApp
 
 
 =head1 RUNNING THE "CANNED" CATALYST TESTS
@@ -219,7 +219,9 @@ editor and enter the following:
     $ua1->title_is("Book Created", "Book created title");
     $ua1->content_contains("Added book 'TestTitle'", "Check title added OK");
     $ua1->content_contains("by 'Stevens'", "Check author added OK");
-    $ua1->content_contains("a rating of 2.", "Check rating added");
+    $ua1->content_contains("with a rating of 2.", "Check rating added");
+    # Try a regular expression to combine the previous 3 checks & account for whitespace
+    $ua1->content_like(qr/Added book 'TestTitle'\s+by 'Stevens'\s+with a rating of 2./, "Regex check");
     
     # Make sure the new book shows in the list
     $ua1->get_ok("http://localhost/books/list", "'test01' book list");
@@ -318,7 +320,7 @@ before.
 Kennedy Clark, C<hkclark@gmail.com>
 
 Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catlayst Tutorial can be found at
+most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006, Kennedy Clark, under Creative Commons License