This chapter of the tutorial takes a brief look at the primary options
available for troubleshooting Catalyst applications.
+Source code for the tutorial in included in the F</home/catalyst/Final>
+directory of the Tutorial Virtual machine (one subdirectory per
+chapter). There are also instructions for downloading the code in
+L<Catalyst::Manual::Tutorial::01_Intro>.
+
+
Note that when it comes to debugging and troubleshooting, there are two
camps:
$c->log->error
$c->log->fatal
-You can also use L<Data::Dumper> in both Catalyst code
-(C<use Data::Dumper; $c-E<gt>log-E<gt>debug("\$var is: ".Dumper($var));)>)
-and TT templates (C<[% Dumper.dump(book) %]>.
+You can also use Data::Dumper in both Catalyst code and in TT templates.
+For use in Catalyst code:
+
+ use Data::Dumper;
+ $c->log->debug("\$var is: ".Dumper($c->stash->{something}));
+
+and TT templates:
+
+ [% USE Dumper ; Dumper.dump(c.stash.something) %].
B<NOTE:> Whether you are a logging fanatic or not, we strongly recommend
that you take advantage of L<Log::Log4perl> or L<Log::Dispatch>. It's
C<MyApp::Controller::list> method, the console session running the
development server will drop to the Perl debugger prompt:
- MyApp::Controller::Books::list(/root/MyApp/script/../lib/MyApp/Controller/Books.pm:48):
+ MyApp::Controller::Books::list(/home/catalyst/MyApp/script/../lib/MyApp/Controller/Books.pm:48):
48: $c->stash->{books} = [$c->model('DB::Book')->all];
DB<1>
DB<1> n
SELECT me.id, me.title, me.rating, me.created, me.updated FROM book me:
- MyApp::Controller::Books::list(/root/MyApp/script/../lib/MyApp/Controller/Books.pm:53):
+ MyApp::Controller::Books::list(/home/catalyst/MyApp/script/../lib/MyApp/Controller/Books.pm:53):
53: $c->stash->{template} = 'books/list.tt2';
DB<1>