$ cd MyApp
This creates a similar skeletal structure to what we saw in Part 2 of
-the tutorial, except with C<MyApp> or C<myapp> substituted for
+the tutorial, except with C<MyApp> and C<myapp> substituted for
C<Hello> and C<hello>.
generally referred to as your I<application class>) and delete the line
with:
- use Catalyst qw/-Debug ConfigLoader Static::Simple/;
+ __PACKAGE__->setup(qw/-Debug ConfigLoader Static::Simple/);
Replace it with:
- use Catalyst qw/
+ __PACKAGE__->setup(qw/
-Debug
ConfigLoader
Static::Simple
StackTrace
- /;
+ /);
This tells Catalyst to start using one new plugin:
application. Also take a look at C<lib/MyApp/View/TT.pm> for config
values set by the C<TTSite> helper.
-B<TIP>: Note that TTSite does one thing that could confuse people who
-are used to the normal C<TT> Catalyst view: it redefines the Catalyst
-context object in templates from its usual C<c> to C<Catalyst>. When
-looking at other Catalyst examples, remember that they almost always use
-C<c>. Note that Catalyst and TT I<do not complain> when you use the
-wrong name to access the context object...TT simply outputs blanks for
-that bogus logic (see next tip to change this behavior with TT C<DEBUG>
-options). Finally, be aware that this change in name I<only>
-applies to how the context object is accessed inside your TT templates;
-your controllers will continue to use C<$c> (or whatever name you use
-when fetching the reference from C<@_> inside your methods). (You can
-change back to the "default" behavior be removing the C<CATALYST_VAR>
-line from C<lib/MyApp/View/TT.pm>, but you will also have to edit
-C<root/lib/config/main> and C<root/lib/config/url>. If you do this, be
-careful not to have a collision between your own C<c> variable and the
-Catalyst C<c> variable.)
-
B<TIP>: When troubleshooting TT it can be helpful to enable variable
C<DEBUG> options. You can do this in a Catalyst environment by adding
a C<DEBUG> line to the C<__PACKAGE__->config> declaration in
C<lib/MyApp/View/TT.pm>:
__PACKAGE__->config({
- CATALYST_VAR => 'Catalyst',
...
DEBUG => 'undef',
...