NAME
Devel::Command - Perl extension to automatically load and register debugger command extensions
SYNOPSIS
# in .perldb:
use Devel::Command;
sub afterinit {
Devel::Command->install;
}
DESCRIPTION
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.
ROUTINES
import
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.
cmds
A new debugger command to list the commands installed by Devel::Command
.
afterinit
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.
EXPORTED INTO PLUGINS
eval
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.
INHERITED BY SUBCLASSES
signature
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.
SEE ALSO
perl5db.pl
, notably the documentation for the DB::DB
subroutine in more recent Perls (5.8.1 and later).
AUTHOR
Joe McMahon, <mcmahon@ibiblio.org>
COPYRIGHT AND LICENSE
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.