The Devel::ebug module by Lťon Brocard provides an object-oriented interface to Perlís debugger facility. Itís a work in progress, so what I say here might be different by the time you read this. The main features should still be there, though.
It comes with its own terminal-based debugger named ebug. Itís a bit of an odd name until you realize how you call it. The missing d in the name comes from Perlís -d switch.
$ perl -d:ebug program.pl
I donít need to use the -d switch, though, since I can call it directly with the ebug program, but I have to call it by quoting the entire command line:Ü
$ ebug "add_numbers.pl 5 6" * Welcome to Devel::ebug 0.46 main(add_numbers.pl#3): my $n = shift @ARGV; ebug: x @ARGV --- 5 --- 6
main(add_numbers.pl#3): my $n = shift @ARGV; ebug: s main(add_numbers.pl#4): my $m = $ARGV; ebug: x $n --- 5
The ebug program is really just a wrapper around Devel::ebug::Console, and I can call Devel::ebug in many different ways. At the core of its design is a detached process. The backend runs the program under the debugger, and the frontend communicates with it over TCP. This means, for instance, I can debug the program on a different machine than on the one itís running.
The Devel::ebug::HTTP module uses the same Devel::ebug backend, but sets up a mini web server.á I start the ebug_http the same way I did with the console version, but instead of giving me a prompt, it tells me the URL I need to access to see the debugger:ß
$ ebug_http "add_numbers.pl 4 5" You can connect to your server at http://albook.local:8321
The web page shows me a bare bones debugger interface (Figure 4-4). Remember, this is basically a proof of concept, but even as that itís very impressive and can serve as the basis for your own tailor-made programs.
Figure 4-4. The Devel::ebug::HTTP module lets me debug a program on a remote server through my browser