Note that we do not need to make any change to the
C<lib/MyApp/Schema.pm> schema file. It simply tells DBIC to
-load all of the result source files it finds in below the
+load all of the result class files it finds in below the
C<lib/MyApp/Schema> directory, so it will automatically pick
up our new table information.
'-------------------------------------------------------------------+----------'
...
-Again, notice that your "result source" classes have been "re-loaded"
+Again, notice that your "result class" classes have been "re-loaded"
by Catalyst under C<MyApp::Model>.
Edit C<lib/MyApp.pm> and update it as follows (everything below
C<StackTrace> is new):
- __PACKAGE__->setup(qw/
+ use Catalyst qw/
-Debug
ConfigLoader
Static::Simple
Session
Session::Store::FastMmap
Session::State::Cookie
- /);
+ /;
The C<Authentication> plugin supports Authentication while the
C<Session> plugins are required to maintain state across multiple HTTP
First, as noted in Part 3 of the tutorial, Catalyst has recently
switched from a default config file format of YAML to
-C<Config::General> (an apache-like format). In case you are using
-a version of Catalyst earlier than v5.7014, delete the C<myapp.yml>
-file and simply follow the directions below to create a new
-C<myapp.conf> file.
+C<Config::General> (an apache-like format). In case you are using a
+version of Catalyst earlier than v5.7014, delete the C<myapp.yml>, or
+convert it to .conf format using the TIP in
+L<Catalyst::Manual::MoreCatalystBasics>; then simply follow the
+directions below to create a new C<myapp.conf> file.
Here, we need to load several parameters that tell
L<Catalyst::Plugin::Authentication|Catalyst::Plugin::Authentication>
# NOTE: Omit 'MyApp::Model' here just as you would when using
# '$c->model("DB::Users)'
user_class DB::Users
- # This is the name of the field in your 'users' table that
- # contains the user's name
- id_field username
</store>
</dbic>
</realms>
if ($username && $password) {
# Attempt to log the user in
if ($c->authenticate({ username => $username,
- password => $password} )) {
+ password => $password } )) {
# If successful, then let them use the application
$c->response->redirect($c->uri_for('/books/list'));
return;
# NOTE: Omit 'MyApp::Model' here just as you would when using
# '$c->model("DB::Users)'
user_class DB::Users
- # This is the name of the field in your 'users' table that
- # contains the user's name
- id_field username
</store>
</dbic>
</realms>