X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F03_MoreCatalystBasics.pod;fp=lib%2FCatalyst%2FManual%2FTutorial%2F03_MoreCatalystBasics.pod;h=be9b2ec9a2a16e7f34c90008a4a0a691fdeaa9d5;hp=9bf0ce3d4da63394b5b6380fe40cb1150f44888d;hb=429d1caf111575afa4c25287cc48d7ed712af327;hpb=7ce05098c9b1df9078e709e5a724e821a3b3b00d diff --git a/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod index 9bf0ce3..be9b2ec 100644 --- a/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod @@ -143,7 +143,7 @@ If you prefer, there are several other ways to enable debug output: =item * -the C<$c-Edebug> method on the C<$c> Catalyst context object +the C<< $c->debug >> method on the C<$c> Catalyst context object =item * @@ -498,7 +498,7 @@ This changes the default extension for Template Toolkit from '.tt' to You can also configure components in your application class. For example, Edit C and you should see the default -configuration above the call to C<_PACKAGE__-Esetup> (your defaults +configuration above the call to C<< _PACKAGE__->setup >> (your defaults could be different depending on the version of Catalyst you are using): __PACKAGE__->config( @@ -509,7 +509,7 @@ could be different depending on the version of Catalyst you are using): Change this to match the following (insert a new -C<__PACKAGE__-Econfig> below the existing statement): +C<< __PACKAGE__->config >> below the existing statement): __PACKAGE__->config( name => 'MyApp', @@ -677,7 +677,7 @@ Then use the following command to build a C SQLite database: If you need to create the database more than once, you probably want to issue the C command to delete the database before you use -the C myapp01.sql> command. +the C<< sqlite3 myapp.db < myapp01.sql >> command. Once the C database file has been created and initialized, you can use the SQLite command line environment to do a quick dump of the @@ -882,7 +882,7 @@ L version C<0.05000> or later. Open C and un-comment the model code we left disabled earlier so that your version matches the following -(un-comment the line containing C<[$c-Emodel('DB::Book')-Eall]> +(un-comment the line containing C<< [$c->model('DB::Book')->all] >> and delete the next 2 lines): =head2 list @@ -907,14 +907,14 @@ and delete the next 2 lines): $c->stash(template => 'books/list.tt2'); } -B: You may see the C<$c-Emodel('DB::Book')> un-commented above -written as C<$c-Emodel('DB')-Eresultset('Book')>. The two are -equivalent. Either way, C<$c-Emodel> returns a +B: You may see the C<< $c->model('DB::Book') >> un-commented above +written as C<< $c->model('DB')->resultset('Book') >>. The two are +equivalent. Either way, C<< $c->model >> returns a L which handles queries against the database and iterating over the set of results that is returned. -We are using the C<-Eall> to fetch all of the books. DBIC supports +We are using the C<< ->all >> to fetch all of the books. DBIC supports a wide variety of more advanced operations to easily do things like filtering and sorting the results. For example, the following could be used to sort the results by descending title: @@ -943,7 +943,7 @@ you are using a different shell (for example, under tcsh, use C). B You can also set this in your code using -C<$class-Estorage-Edebug(1);>. See +C<< $class->storage->debug(1); >>. See L for details (including options to log to a file instead of displaying to the Catalyst development server log). @@ -1132,7 +1132,7 @@ Notice the status and error message sections in the code above: [% error_msg %] If we set either message in the Catalyst stash (e.g., -C<$c-Estash-E{status_msg} = 'Request was successful!'>) it will +C<< $c->stash->{status_msg} = 'Request was successful!' >>) it will be displayed whenever any view used by that request is rendered. The C and C CSS styles can be customized to suit your needs in the C file we create below. @@ -1349,12 +1349,12 @@ C<1;> on a line by itself. The C relationship bridge is optional, but it makes it easier to map a book to its collection of authors. Without it, we would have to "walk" through the C table as in -C<$book-Ebook_author-Efirst-Eauthor-Elast_name> (we will +C<< $book->book_author->first->author->last_name >> (we will see examples on how to use DBIx::Class objects in your code soon, but -note that because C<$book-Ebook_author> can return multiple authors, +note that because C<< $book->book_author >> can return multiple authors, we have to use C to display a single author). C allows us to use the shorter -C<$book-Eauthor-Efirst-Elast_name>. Note that you cannot +C<< $book->author->first->last_name >>. Note that you cannot define a C relationship bridge without also having the C relationship in place. @@ -1454,7 +1454,7 @@ DBIx::Class): JOIN author author ON author.id = me.author_id WHERE ( me.book_id = ? ): '5' Also note in C that we are using "| html", a -type of TT filter, to escape characters such as E and E to < +type of TT filter, to escape characters such as < and > to < and > and avoid various types of dangerous hacks against your application. In a real application, you would probably want to put "| html" at the end of every field where a user has control over the @@ -1587,11 +1587,11 @@ By default, C will look for a template that uses the same name as your controller action, allowing you to save the step of manually specifying the template name in each action. For example, this would allow us to remove the -C<$c-Estash-E{template} = 'books/list.tt2';> +C<< $c->stash->{template} = 'books/list.tt2'; >> line of our C action in the Books controller. Open C in your editor and comment out this line to match the following (only the -C<$c-Estash-E{template}> line has changed): +C<< $c->stash->{template} >> line has changed): =head2 list @@ -1620,8 +1620,8 @@ You should now be able to access the L URL as before. B If you use the default template technique, you -will B be able to use either the C<$c-Eforward> or the -C<$c-Edetach> mechanisms (these are discussed in Chapter 2 and +will B be able to use either the C<< $c->forward >> or the +C<< $c->detach >> mechanisms (these are discussed in Chapter 2 and Chapter 9 of the Tutorial). B Make sure that you do B skip the following section @@ -1630,7 +1630,7 @@ before continuing to the next chapter 4 Basic CRUD. =head2 Return To A Manually Specified Template -In order to be able to use C<$c-Eforward> and C<$c-Edetach> +In order to be able to use C<< $c->forward >> and C<< $c->detach >> later in the tutorial, you should remove the comment from the statement in C in C: