DB::Pluggable::Plugin::BreakOnTestNumber - Debugger plugin to break on Test::Builder-based tests
$ cat ~/.perldb use DB::Pluggable; DB::Pluggable->run_with_config(\<<EOINI) [BreakOnTestNumber] EOINI $ perl -d foo.pl Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. 1..9 ... DB<1> b #5 DB<2> r
This debugger plugin extends the debugger's b command - used to set breakpoints - with the ability to stop at a specific test number. Andy Armstrong had the idea and wrote the original code, see http://use.perl.org/~AndyArmstrong/journal/35792.
b
Sets up the command handler that checks whether the command is of the form b #12 or b #12, 34, .... If so, it sets breakpoints to break as soon as the given test has finished. If test-based breakpoints have been found, the standard DB::cmd_b() function that handles the b command is short-circuited.
b #12
b #12, 34, ...
DB::cmd_b()
If it handles the command, it enables the watchfunction().
watchfunction()
This plugin overwrites Test::Builder::lock() to be able to detect that a test is about to be finished - see the source code of Test::Builder for details. Yes, this is nasty. It also means that this plugin will break Test::Builder when using threads.
Test::Builder::lock()
Test::Builder
Checks the current test number from Test::Builder and instructs the debugger to stop if an appropriate test number has been reached.
To install DB::Pluggable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DB::Pluggable
CPAN shell
perl -MCPAN -e shell install DB::Pluggable
For more information on module installation, please visit the detailed CPAN module installation guide.