| Devel-Command documentation | view source | Contained in the Devel-Command distribution. |
Devel::Command - Perl extension to automatically load and register debugger command extensions
# in .perldb:
use Devel::Command;
sub afterinit {
Devel::Command->install;
}
Devel::Command provides a simple means to extend the Perl debugger with
custom commands. It uses Module::Pluggable to locate the command modules,
and installs these into a debugger global (%DB::commands).
It then searches the Devel::Command::DBSub namespace to locate an
appropriate debugger patch plugin and installs it to enable the new commands.
import finds all of the command plugins for this package
(i.e., any module in the Devel::Command:: namespace),
calls the module's signature method to get the name of
the command and its entry point, and then exports our
eval subroutine into the command's namespace.
Finally, it overrides the debugger's DB::DB()
subroutine with the proper patched version of that routine
by calling the import() routine in each of the DB
plugins in ascending version order; the last one that returns a subroutine
reference is used.
A new debugger command to list the commands
installed by Devel::Command.
Does any necessary initialization for a
debugger command module. Gets run after the
debugger has initialized, but before the
initial prompt. Calls the afterinit subroutine
in each command plugin's namespace.
This routine is explicitly exported into the
plugins so that they can call the debugger's
eval routinei without having to fiddle with
the bizarre calling sequence used by the debugger.
The signature method is common to all subclasses
and is needed to handle the interfacing to this
module. The default method (this one) returns a best-guess
name for the command (by downcasing the last qualifier of the
fully-qualified package name) and a reference to the
command() subroutine in the command package itself.
Note that subclasses are free to override this method and do anything they please as long as the overrding method returns a command name and a subroutine reference to the code to be used to perform the command.
perl5db.pl, notably the documentation for the DB::DB subroutine
in more recent Perls (5.8.1 and later).
Joe McMahon, <mcmahon@ibiblio.org>
Copyright (C) 2005 by Joe McMahon
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
| Devel-Command documentation | view source | Contained in the Devel-Command distribution. |