X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FDebugging.pod;h=6a2d9427ba6efb07ff439fc6cc1ac2ad4bdeae7f;hp=b320b17109784f5a864b1d82e0f31a4a298bb2ff;hb=3533daff0314522f79dff9c618da087568f1378c;hpb=fb678498f0f844142f45046dc8078590edd50615 diff --git a/lib/Catalyst/Manual/Tutorial/Debugging.pod b/lib/Catalyst/Manual/Tutorial/Debugging.pod index b320b17..6a2d942 100644 --- a/lib/Catalyst/Manual/Tutorial/Debugging.pod +++ b/lib/Catalyst/Manual/Tutorial/Debugging.pod @@ -1,10 +1,11 @@ =head1 NAME -Catalyst::Manual::Tutorial::Debugging - Catalyst Tutorial - Part 6: Debugging +Catalyst::Manual::Tutorial::Debugging - Catalyst Tutorial - Part 7: Debugging + =head1 OVERVIEW -This is B for the Catalyst tutorial. +This is B for the Catalyst tutorial. L @@ -20,30 +21,34 @@ L =item 3 -L +L =item 4 -L +L =item 5 -L +L =item 6 -B +L =item 7 -L +B =item 8 -L +L =item 9 +L + +=item 10 + L =back @@ -102,7 +107,7 @@ C line as follows inside the C method (I like to you can obviously indent them if you prefer): sub list : Local { - # Retrieve the usual perl OO '$self' for this object. $c is the Catalyst + # Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst # 'Context' that's used to 'glue together' the various components # that make up the application my ($self, $c) = @_; @@ -111,7 +116,7 @@ you can obviously indent them if you prefer): # 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('MyAppDB::Book')->all]; + $c->stash->{books} = [$c->model('MyAppDB::Books')->all]; # Set the TT template to use. You will almost always want to do this # in your action methods. @@ -150,7 +155,7 @@ C method, the console session running the development server will drop to the Perl debugger prompt: MyApp::Controller::Books::list(/home/me/MyApp/script/../lib/MyApp/Controller/Books.pm:40): - 40: $c->stash->{books} = [$c->model('MyAppDB::Book')->all]; + 40: $c->stash->{books} = [$c->model('MyAppDB::Books')->all]; DB<1> @@ -172,7 +177,7 @@ output also shows up in the development server debug information. Next, list the methods available on our C model: - DB<1> m $c->model('MyAppDB::Book') + DB<1> m $c->model('MyAppDB::Books') () (0+ (bool @@ -191,7 +196,7 @@ Next, list the methods available on our C model: We can also play with the model directly: - DB<2> x ($c->model('MyAppDB::Book')->all)[1]->title + DB<2> x ($c->model('MyAppDB::Books')->all)[1]->title SELECT me.id, me.title, me.rating FROM books me: 0 'TCP/IP Illustrated, Volume 1' @@ -249,6 +254,10 @@ copy of an installed module: mkdir -p lib/Module; cp `perldoc -l Module::Name` lib/Module/ +Note: If you are following along in Ubuntu, you will need to install +the C package to use the C command. Use +C to do that. + For example, you could make a copy of L with the following command: @@ -256,6 +265,9 @@ with the following command: mkdir -p lib/Catalyst/Plugin; cp \ `perldoc -l Catalyst::Plugin::Authentication` lib/Catalyst/Plugin +You can then use the local copy inside your project to place logging +messages and/or breakpoints for further study of that module. + B Matt has also suggested the following tips for Perl debugging: @@ -282,7 +294,7 @@ Check if a modules contains a given method: For example: $ perl -MCatalyst::Plugin::Authentication -e \ - 'print Catalyst::Plugin::Authentication->can("prepare");' + 'print Catalyst::Plugin::Authentication->can("user");' CODE(0x9c8db2c) If the method exists, the Perl C method returns a coderef.