Devel::REPL and Carp::REPL
By Shawn Moore (Sartak) from Tsukuba.pm
Date: Saturday, February 7, 2009 01:20 PM
Duration: 45 minutes
Target audience: Intermediate/Advanced
Language:
Tags: debugging moose plugins repl roles
You can find more information on the speaker's site:
(10min) Devel::REPL is an excellent addition to your toolkit. It is an interactive shell for Perl; you type in a line of Perl code and Devel::REPL will evaluate it. You can use Devel::REPL to quickly test out code or to provide a debugging shell for your applications. There are many plugins, such as simply adding color, nopasting your session to a pastebin, and even dumping each line of code with B::Concise.
(15min) Carp::REPL builds on top of Devel::REPL to make finding bugs easier. By default, when an exception is thrown, you get a shell (though you can tweak this to get a shell on any warning or test failure). You can examine and change variables, call and redefine functions, and anything else you can do with real Perl code. Carp::REPL lets you have a shell "inside" your applications with *zero* code changes required.
(20min) Matt Trout's design for Devel::REPL is worthy of study. It is a Moose library that makes heavy use of roles to provide a great deal of customization for users. Sans plugins, Devel::REPL is just about the simplest implementation of a shell, but that just means it has the greatest amount of flexibility. This final part of the talk will be case study in the design and implementation of a nontrivial Moose application.
