X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F04_BasicCRUD.pod;h=c2135f7cb32c71778ae3d7a248f90c913b599c09;hp=dfee243e4711aada013023ed1c3385d2b0e36f01;hb=2217b252905d370f4f7840cf78996d43c79e5d4f;hpb=663a29ba7d74376cbf82f85df9fca87a4a0e0a37 diff --git a/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod b/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod index dfee243..c2135f7 100644 --- a/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod +++ b/lib/Catalyst/Manual/Tutorial/04_BasicCRUD.pod @@ -68,15 +68,15 @@ functionality, will be addressed in Chapter 9. Although this chapter of the tutorial will show you how to build CRUD functionality yourself, another option is to use a "CRUD builder" type -of tool to automate the process. You get less control, but it's quick -and easy. For example, see -L, -L, and -L. +of tool to automate the process. You get less control, but it can be +quick and easy. For example, see +L, +L, and +L. You can check out the source code for this example from the Catalyst Subversion repository as per the instructions in -L. +L. =head1 FORMLESS SUBMISSION @@ -96,7 +96,7 @@ Edit C and enter the following method: =cut - sub url_create : Local { + sub url_create :Local { # In addition to self & context, get the title, rating, & # author_id args from the URL. Note that Catalyst automatically # puts extra information after the "// and enter the following method: # Note: Above is a shortcut for this: # $book->create_related('book_authors', {author_id => $author_id}); - # Assign the Book object to the stash for display in the view - $c->stash->{book} = $book; - - # Set the TT template to use - $c->stash->{template} = 'books/create_done.tt2'; + # Assign the Book object to the stash for display and set template + $c->stash(book => $book, + template => 'books/create_done.tt2'); } Notice that Catalyst takes "extra slash-separated information" from the @@ -170,7 +168,7 @@ Edit C and then enter: The TT C directive allows access to a variety of plugin modules (TT plugins, that is, not Catalyst plugins) to add extra functionality to the base TT capabilities. Here, the plugin allows -L "pretty printing" of objects and +L "pretty printing" of objects and variables. Other than that, the rest of the code should be familiar from the examples in Chapter 3. @@ -183,31 +181,23 @@ outputs the "last name for the first author" above to match this: to get around an issue in TT v2.15 where blessed hash objects were not handled correctly. But, if you are still using v2.15, it's probably -time to upgrade (v2.15 is exactly 3 years old on the day I'm typing -this). If you are following along in Debian, then you should be on at -least v2.20. You can test your version of Template Toolkit with the -following: +time to upgrade (v2.15 is almost 4 years old). If you are following +along in Debian, then you should be on at least v2.20. You can test +your version of Template Toolkit with the following: perl -MTemplate -e 'print "$Template::VERSION\n"' =head2 Try the 'url_create' Feature -If the application is still running from before, use C to kill -it. Then restart the server: +Make sure the development server is running with the "-r" restart +option: - $ DBIC_TRACE=1 script/myapp_server.pl + $ DBIC_TRACE=1 script/myapp_server.pl -r Note that new path for C appears in the startup debug output. -B: You can use C