X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2F03_MoreCatalystBasics.pod;h=061bd38e3facc833951ded4734e0058c5fb5a0a5;hb=7040a6cd5a2b1aa0eb7ba504c1ac7b57021b1946;hp=a8e1f31b4f9f661911c4efe7956cc4bab71368cc;hpb=f33d1dd71df036c7ed6d8ce4ba78bc283b301f32;p=catagits%2FCatalyst-Manual.git diff --git a/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod index a8e1f31..061bd38 100644 --- a/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod @@ -345,7 +345,7 @@ method" that you don't want to be an action at all, then just define the method without any attribute -- you can call it in your code, but the Catalyst dispatcher will ignore it.) -There are five types of "special" build-in C<:Private> actions: +There are five types of "special" built-in C<:Private> actions: C, C, C, C, and C. =over 4 @@ -436,22 +436,20 @@ but its use is now deprecated. Enter the following command to enable the C style of view rendering for this tutorial: - $ script/myapp_create.pl view TT TT + $ script/myapp_create.pl view HTML TT exists "/home/me/MyApp/script/../lib/MyApp/View" exists "/home/me/MyApp/script/../t" - created "/home/me/MyApp/script/../lib/MyApp/View/TT.pm" - created "/home/me/MyApp/script/../t/view_TT.t" - -This simply creates a view called C (the second 'TT' argument) in -a file called C (the first 'TT' argument). It is now up to you -to decide how you want to structure your view layout. For the -tutorial, we will start with a very simple TT template to initially -demonstrate the concepts, but quickly migrate to a more typical -"wrapper page" type of configuration (where the "wrapper" controls the -overall "look and feel" of your site from a single file or set of -files). - -Edit C and you should see that the default + created "/home/me/MyApp/script/../lib/MyApp/View/HTML.pm" + created "/home/me/MyApp/script/../t/view_HTML.t" + +This simply creates a view called C in a file called C (the first +argument). It is now up to you to decide how you want to structure your view +layout. For the tutorial, we will start with a very simple TT template to +initially demonstrate the concepts, but quickly migrate to a more typical +"wrapper page" type of configuration (where the "wrapper" controls the overall +"look and feel" of your site from a single file or set of files). + +Edit C and you should see that the default contents contains something similar to the following: __PACKAGE__->config(TEMPLATE_EXTENSION => '.tt'); @@ -682,7 +680,7 @@ applications rely on DBIx::Class, as will this tutorial. Although DBIx::Class has included support for a C mode to automatically read the database structure every time the -application starts, it's use is no longer recommended. While it can +application starts, its use is no longer recommended. While it can make for "flashy" demos, the use of the C mode we use below can be implemented just as quickly and provides many advantages (such as the ability to add your own methods to the overall DBIC @@ -823,7 +821,7 @@ when you launch the application). B Older versions of L use the deprecated DBIx::Class C technique instead of the newer -C. For new applications, please try to use +C. For new applications, please try to use C since it more easily supports a very useful DBIC technique called "ResultSet Classes." If you need to convert an existing application from "load_classes" to "load_namespaces," you can @@ -936,7 +934,7 @@ display something like: | MyApp::Model::DB::Author | class | | MyApp::Model::DB::Book | class | | MyApp::Model::DB::BookAuthor | class | - | MyApp::View::TT | instance | + | MyApp::View::HTML | instance | '-----------------------------------------------------------------+----------' [debug] Loaded Private actions: @@ -1018,12 +1016,12 @@ will appear across your entire site/application instead of having to edit many individual files. -=head2 Configure TT.pm For The Wrapper +=head2 Configure HTML.pm For The Wrapper In order to create a wrapper, you must first edit your TT view and tell it where to find your wrapper file. -Edit you TT view in C and change it to match the +Edit you TT view in C and change it to match the following: __PACKAGE__->config( @@ -1176,7 +1174,7 @@ provide lots of high-quality CSS functionality. Hit "Reload" in your web browser and you should now see a formatted version of our basic book list. (Again, the development server should have automatically restarted when you made changes to -C. If you are not using the "-r" option, you will +C. If you are not using the "-r" option, you will need to hit C and manually restart it. Also note that the development server does I need to restart for changes to the TT and static files we created and edited in the C directory -- those @@ -1289,14 +1287,15 @@ L for the details. Although recent versions of SQLite and L automatically handle the C and C relationships, -C relationships currently need to be manually inserted. -To add a C relationship, first edit +C relationship bridges (not technically a relationship) +currently need to be manually inserted. +To add a C relationship bridge, first edit C and add the following text below the C<# You can replace this text...> comment: # many_to_many(): # args: - # 1) Name of relationship, DBIC will create accessor with this name + # 1) Name of relationship bridge, DBIC will create accessor with this name # 2) Name of has_many() relationship this many_to_many() is shortcut for # 3) Name of belongs_to() relationship in model class of has_many() above # You must already have the has_many() defined to use a many_to_many(). @@ -1307,26 +1306,26 @@ file. As with any Perl package, we need to end the last line with a statement that evaluates to C. This is customarily done with C<1;> on a line by itself. -The C relationship is optional, but it makes it +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" though the C table as in +it, we would have to "walk" through the C table as in C<$book-Ebook_author-Efirst-Eauthor-Elast_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, 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 -define a C relationship without also having the +define a C relationship bridge without also having the C relationship in place. Then edit C and add the reverse -C relationship for C as follows (again, be careful +C relationship bridge for C as follows (again, be careful to put in above the C<1;> but below the C<# DO NOT MODIFY THIS OR ANYTHING ABOVE!> comment): # many_to_many(): # args: - # 1) Name of relationship, DBIC will create accessor with this name + # 1) Name of relationship bridge, DBIC will create accessor with this name # 2) Name of has_many() relationship this many_to_many() is shortcut for # 3) Name of belongs_to() relationship in model class of has_many() above # You must already have the has_many() defined to use a many_to_many(). @@ -1585,7 +1584,7 @@ statement in C in C: $c->stash(template => 'books/list.tt2'); Then delete the C line in -C. +C. Check the L URL in your browser. It should look the same manner as with earlier sections. @@ -1599,5 +1598,6 @@ Please report any errors, issues or suggestions to the author. The most recent version of the Catalyst Tutorial can be found at L. -Copyright 2006-2008, Kennedy Clark, under Creative Commons License +Copyright 2006-2010, Kennedy Clark, under the +Creative Commons Attribution Share-Alike License Version 3.0 (L).