Here, we will make use of the L<HTML::Widget|HTML::Widget> to not only
ease form creation, but to also provide validation of the submitted
-data. The approached used by the part of the tutorial is to slowly
+data. The approached used by this part of the tutorial is to slowly
incorporate additional L<HTML::Widget|HTML::Widget> functionality in a
step-wise fashion (we start with fairly simple form creation and then
move on to more complex and "magical" features such as validation and
# Set a status message for the user
$c->stash->{status_msg} = 'Book created';
- # Use 'hw_create' to redisplay the form
+ # Use 'hw_create' to redisplay the form. As discussed in
+ # Part 3, 'detach' is like 'forward', but it does not return
$c->detach('hw_create');
}
not receive path args as with other actions. The recommended practice
is to only use C<default> in C<MyApp::Controller::Root>.
-Another options would be to use something like
+Another option would be to use something like
C<sub base :Path :Args(0) {...}> (where the C<...> refers to the login
code shown in C<sub index : Private> above). We are using C<sub base
:Path :Args(0) {...}> here to specifically match the URL C</login>.
Catalyst provides a number of helper scripts that can be used to quickly
flesh out the basic structure of your application. All Catalyst projects
-begin with the C<catalyst.pl> helper.
+begin with the C<catalyst.pl> helper (see L<Catalyst::Helper|Catalyst::Helper>
+for more information on helpers). Also note that as of Catalyst 5.7000,
+you will not have the helper scripts unless you install both
+L<Catalyst::Runtime|Catalyst::Runtime> and L<Catalyst::Devel|Catalyst::Devel>.
In the case of this tutorial, use the Catalyst C<catalyst.pl> script to
initialize the framework for an application called C<MyApp>:
$c->stash->{books} = [$c->model('MyAppDB::Book')->all];
# Set the TT template to use. You will almost always want to do this
- # in your action methods.
+ # in your action methods (actions methods respond to user input in
+ # your controllers).
$c->stash->{template} = 'books/list.tt2';
}
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<MyApp/View/TT.pm>:
+C<lib/MyApp/View/TT.pm>:
__PACKAGE__->config({
CATALYST_VAR => 'Catalyst',
end action" to your application class (C<MyApp.pm>) or Root.pm
(C<MyApp/Controller/Root.pm>). These examples should be easily
converted to L<RenderView|Catalyst::Action::RenderView> by simply adding
-C<ActionClass('RenderView')> to the C<sub end> definition. If end sub is
-defined in your application class (C<MyApp.pm>), you should also migrate
-it to C<MyApp/Controller/Root.pm>.
+the attribute C<:ActionClass('RenderView')> to the C<sub end>
+definition. If end sub is defined in your application class
+(C<MyApp.pm>), you should also migrate it to
+C<MyApp/Controller/Root.pm>.
=item *
=back
This tutorial makes the learning process its main priority. For
-example, the level of comments in the code found here would like be
+example, the level of comments in the code found here would likely be
considered excessive in a "normal project". Because of their contextual
value, this tutorial will generally favor inline comments over a
separate discussion in the text. It also deliberately tries to