Point users to RT
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Tutorial / 03_MoreCatalystBasics.pod
index 89e5e2e..89f6330 100644 (file)
@@ -229,7 +229,7 @@ Don't let these variations confuse you -- they all accomplish the same
 result.
 
 This tells Catalyst to start using one additional plugin, 
-L<Catalyst::Plugin::StackTrace|Catalyst::Plugin::StackTrace>, to add a 
+L<Catalyst::Plugin::StackTrace>, to add a 
 stack trace to the standard Catalyst "debug screen" (the screen 
 Catalyst sends to your browser when an error occurs). Be aware that 
 L<StackTrace|Catalyst::Plugin::StackTrace> output appears in your 
@@ -449,30 +449,61 @@ 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<lib/MyApp/View/HTML.pm> and you should see that the default
-contents contains something similar to the following:
+Edit C<lib/MyApp/View/HTML.pm> and you should see
+something similar to the following:
 
-    __PACKAGE__->config(TEMPLATE_EXTENSION => '.tt');
+    __PACKAGE__->config(
+        TEMPLATE_EXTENSION => '.tt',
+        render_die => 1,
+    );
 
 And update it to match:
 
     __PACKAGE__->config(
         # Change default TT extension
         TEMPLATE_EXTENSION => '.tt2',
-        # Set the location for TT files
-        INCLUDE_PATH => [
-                MyApp->path_to( 'root', 'src' ),
+        render_die => 1,
+    );
+
+This changes the default extension for Template Toolkit from '.tt' to
+'.tt2'.
+
+You can also configure components in your application class. For example,
+Edit C<lib/MyApp.pm> and you should see that the default:
+
+    __PACKAGE__->setup;
+
+Above this, add config:
+
+    __PACKAGE__->config(
+        'View::HTML' => {
+            #Set the location for TT files
+            INCLUDE_PATH => [
+                __PACKAGE__->path_to( 'root', 'src' ),
             ],
+        },
     );
+    # This line was here already
+    __PACKAGE__->setup;
+
+This changes the base directory for your template files from
+C<root> to C<root/src>.
+
+The reason to do this outside the C<lib/MyApp/View/HTML.pm> file
+is that the template path is found with the C<path_to> method,
+to get a path relative to the application root (no matter where it
+is installed), but this requires the application to be loaded...
 
-B<NOTE:> Make sure to add a comma after '.tt2' outside the single
-quote.
+Trying to set this setting in the view means that you have a chicken
+and egg problem, in that the view requires the application to be loaded,
+but loading the application loads the view.
 
-This changes the default extension for Template Toolkit from '.tt' to 
-'.tt2' and changes the base directory for your template files from 
-C<root> to C<root/src>.  Stick with these conventions for the 
-tutorial, but feel free to use whatever options you desire in your 
-applications (as with most things Perl, there's more than one way to 
+Putting the configuration which depends on the application class into
+that class is the neatest way to avoid this issue.
+
+Please stick with the settings above for the duration of the
+tutorial, but feel free to use whatever options you desire in your
+applications (as with most things Perl, there's more than one way to
 do it...).
 
 B<Note:> We will use C<root/src> as the base directory for our 
@@ -481,22 +512,6 @@ C<root/src/_controller_name_/_action_name_.tt2>.  Another popular option is to
 use C<root/> as the base (with a full filename pattern of 
 C<root/_controller_name_/_action_name_.tt2>).
 
-B<NOTE:> Since we've added a call to C<< MyApp->path_to() >> inside of
-C<lib/MyApp/View/HTML.pm>, we need to update C<t/view_HTML.t> to include
-C<MyApp> or the test will fail. Edit C<t/view_HTML.t> and add the C<use>
-statement after the others, so this:
-
-    use Test::More;
-    
-    BEGIN { use_ok 'MyApp::View::HTML' }
-
-looks like this:
-
-    use Test::More;
-    use MyApp;
-
-    BEGIN { use_ok 'MyApp::View::HTML' }
-
 =head2 Create a TT Template Page
 
 First create a directory for book-related TT templates:
@@ -536,10 +551,10 @@ looping, conditional logic, etc.  In general, TT simplifies the usual
 range of Perl operators down to the single dot (".") operator.  This
 applies to operations as diverse as method calls, hash lookups, and list
 index values (see
-L<http://search.cpan.org/perldoc?Template::Manual::Variables> for
+L<https://metacpan.org/module/Template::Manual::Variables> for
 details and examples).  In addition to the usual L<Template> module Pod
 documentation, you can access the TT manual at
-L<http://search.cpan.org/perldoc?Template::Manual>.
+L<https://metacpan.org/module/Template::Manual>.
 
 B<TIP:> While you can build all sorts of complex logic into your TT 
 templates, you should in general keep the "code" part of your 
@@ -705,7 +720,7 @@ framework, a technique that we see in Chapter 4).
 =head2 Make Sure You Have a Recent Version of the DBIx::Class Model
 
 First, let's be sure we have a recent version of the DBIC helper,
-L<Catalyst::Model::DBIC::Schema|Catalyst::Model::DBIC::Schema>, so
+L<Catalyst::Model::DBIC::Schema>, so
 that we can take advantage of some recent enhancements in how
 foreign keys are handled with SQLite.  To check your version, 
 run this command:
@@ -723,7 +738,7 @@ higher (shown above as "0.4" with the tailing zero removed). If you have
 less than v0.39, you will need to run this command to install it 
 directly from CPAN: 
 
-    $ sudo cpan Catalyst::Model::DBIC::Schema
+    $ cpan -i Catalyst::Model::DBIC::Schema
 
 And re-run the version print command to verify that you are now at 
 0.39 or higher.
@@ -736,6 +751,8 @@ please be sure that you use version C<1.27> of L<DBD::SQLite> or later:
 
 Upgrade if you are not at version C<1.27> or higher.
 
+Also, remember to put a line requiring the version of the module
+you just installed into your Makefile.PL
 
 =head2 Create Static DBIx::Class Schema Files
 
@@ -1609,8 +1626,11 @@ It should look the same manner as with earlier sections.
 
 Kennedy Clark, C<hkclark@gmail.com>
 
-Please report any errors, issues or suggestions to the author.  The
-most recent version of the Catalyst Tutorial can be found at
+Feel free to contact the author for any errors or suggestions, but the
+best way to report issues is via the CPAN RT Bug system at
+<https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Manual>.
+
+The most recent version of the Catalyst Tutorial can be found at
 L<http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Manual/5.80/trunk/lib/Catalyst/Manual/Tutorial/>.
 
 Copyright 2006-2010, Kennedy Clark, under the