NAME Test::NoBreakpoints - test that files do not contain soft breakpoints SYNOPSIS use Test::NoBreakpoints; plan tests => $num_tests; no_brkpts_ok( $file, 'Contains no soft breakpoints' ); Module authors can include the following in a t/nobreakpoints.t file to add such checking to a module distribution: use Test::More; eval "use Test::NoBreakpoints 0.10"; plan skip_all => "Test::NoBreakpoints 0.10 required for testing" if $@; all_files_no_brkpts_ok(); DESCRIPTION I love soft breakpoints ("$DB::single = 1") in the Perl debugger. Unfortunately, I have a habit of putting them in my code during development and forgetting to take them out before I upload it to CPAN, necessitating a hasty fix/package/bundle cycle followed by much cursing. Test::NoBreakpoints checks that files contain neither the string "$DB::single = 1" nor "$DB::signal = 1". By adding such a test to all my modules, I swear less and presumably lighten the load on the CPAN in some small way. FUNCTIONS Unless otherwise noted, all functions are tests built on top of Test::Builder, so the standard admonition about having made a plan before you run them apply. no_brkpts_ok($file, [$description] ) Checks that $file contains no breakpoints. If the optional $description is not passed it defaults to "no breakpoint test of $file". If the test fails, the line number of the file where the breakpoint was found will be emitted. all_perl_files( [@dirs] ) Returns a list of all *.pl, *.pm and *.t files in the directories listed. If @dirs is not passed, defaults to "blib" and "t". The order of the files returned is machine-dependent. If you want them sorted, you'll have to sort them yourself. all_files_no_brkpts_ok( [@files] ) Checks all files that look like they contain Perl using no_brkpts_ok(). If @files is not provided, it defaults to the return of all_perl_files(). EXPORTS By default all_files_no_brkpts_ok and no_brkpts_ok. On request, all_perl_files. Everything with the tag :all. ACKNOWLEDGEMENTS Michael Schwern for Test::Builder. Andy Lester for Test::Pod, which is where I got the idea and borrowed the logic of all_perl_files from. BUGS * doesn't catch some breakpoints This is a valid breakpoint: package DB; $single = 1; package main; as is this: my $break = \$DB::single; $$break = 1; but neither are currently caught. TODO * enhance regex to find esoteric setting of breakpoints If you have a legitimate breakpoint set that isn't caught, please send me an example and I'll try to augment the regex to match it. * only look at code rather than the entire file This is not as easy as simply stripping out POD, because there might be inline tests or examples that are code in there (using Test::Inline). Granted, those should be caught when the generated .t files are themselves tested, but I'd like to make it smarter. * not use regular expressions The ideal way to find a breakpoint would be to compile the code and then walk the opcode tree to find places where the breakpoint is set. B::FindAmpersand does something similar to this to find use of the $& in regular expressions, so this is probably the direction I'm going to head in. SEE ALSO Test::Builder Test::Pod AUTHOR James FitzGibbon COPYRIGHT Copyright (c) 2004, James FitzGibbon. All Rights Reserved. This module is free software. You may use it under the same terms as perl itself.