=over 4
-=item *
+=item *
Fans of C<log> and C<print> statements embedded in the code.
-=item *
+=item *
Fans of interactive debuggers.
following code to a controller action method:
$c->log->info("Starting the foreach loop here");
-
+
$c->log->debug("Value of \$id is: ".$id);
Then the Catalyst development server will display your message along
# 'Context' that's used to 'glue together' the various components
# that make up the application
my ($self, $c) = @_;
-
+
$DB::single=1;
-
+
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template
$c->stash->{books} = [$c->model('DB::Book')->all];
-
+
# Set the TT template to use. You will almost always want to do this
# in your action methods.
$c->stash->{template} = 'books/list.tt2';
This will start the interactive debugger and produce output similar to:
- $ perl -d script/myapp_server.pl
-
+ $ perl -d script/myapp_server.pl
+
Loading DB routines from perl5db.pl version 1.3
Editor support available.
-
+
Enter h or `h h' for help, or `man perldebug' for more help.
-
+
main::(script/myapp_server.pl:16): my $debug = 0;
-
- DB<1>
+
+ DB<1>
Press the C<c> key and hit C<Enter> to continue executing the Catalyst
development server under the debugger. Although execution speed will be
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>
You now have the full Perl debugger at your disposal. First use the
SELECT me.id, me.title, me.rating, me.created, me.updated FROM book me:
MyApp::Controller::Books::list(/home/catalyst/MyApp/script/../lib/MyApp/Controller/Books.pm:53):
53: $c->stash->{template} = 'books/list.tt2';
-
+
DB<1>
This takes you to the next line of code where the template name is set.
_calculate_score
_collapse_cond
<lines removed for brevity>
-
+
DB<2>
We can also play with the model directly:
=over 4
-=item *
+=item *
Check the version of an installed module:
or die qq(module \"\$m\" is not installed\\n); \
print \$m->VERSION'"
-=item *
+=item *
Check if a modules contains a given method: