NAME

Devel::ModuleBreaker - set breakpoints for every subroutine in a namespace simultaneously

VERSION

0.03

SYNOPSIS

$ perl -d:ModuleBreaker=Module1,Another::Module2 script_to_debug.pl

DESCRPITION

Devel::ModuleBreaker seeks to simplify the process of settings breakpoints in a collection of subroutines from one or more modules, without having to enumerate the list of subroutines in the modules.

This module was inspired by a StackOverflow question.

This distribution also comes with the packages

Devel::SubBreaker

to automatically set breakpoints in any compile-time subroutine whose name matches a regular expression

Devel::FileBreaker

to automatically set breakpoints in any compile-time subroutine loaded from a filename that matches a regular expression

ENVIRONMENT

Perl normally reads the PERL5DB environment variable when the -d or -dt switches are included in the perl invocation. This environment variable is used to defined custom debugger subroutines or to get Perl to load a customized debugger script.

When the switch is used like -d:Module, Perl overwrites the PERL5DB environment variable before the debugging module is loaded. Devel::ModuleBreaker, Devel::FileBreaker, and Devel::SubBreaker work around this by analyzing the PERL5DBX environment variable to enable further customization of the debugger. For example, if you can invoke your custom debugger with the command line

PERL5DB='BEGIN{require "myperl5db.pl"}' perl -d myscript.pl

then you could also use the debugger modules in this distribution with a command line like

PERL5DBX='BEGIN{require "myperl5db.pl"}' perl -d:ModuleBreaker=Module1 myscript.pl

USAGE

To use this module, pass this command-line argument to perl

-d:ModuleBreaker=pattern[,pattern2[,...]]

where pattern, pattern2, etc. are any valid perl regular expressions. In the CHECK phase of the program, a breakpoint will be set at the start of any subroutine whose fully qualified subroutine name (given by %DB::sub) matches one of the given regular expressions. This includes anonymous subroutines that are known at compile time.

EXAMPLES

  • Set a breakpoint in all subs just in module Floop::Blert:

    perl -d:ModuleBreaker=Floop::Blert ...

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Devel::ModuleBreaker

You can also look for information at:

SEE ALSO

Devel::SubBreaker, Devel::FileBreaker

AUTHOR

Marty O'Brien, <mob at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2018 Marty O'Brien

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.