1Test::NoBreakpoints(3)User Contributed Perl DocumentationTest::NoBreakpoints(3)
2
3
4

NAME

6       Test::NoBreakpoints - test that files do not contain soft breakpoints
7

SYNOPSIS

9        use Test::NoBreakpoints;
10        plan tests => $num_tests;
11        no_breakpoints_ok( $file, 'Contains no soft breakpoints' );
12
13       Module authors can include the following in a t/nobreakpoints.t file to
14       add such checking to a module distribution:
15
16         use Test::More;
17         eval "use Test::NoBreakpoints 0.10";
18         plan skip_all => "Test::NoBreakpoints 0.10 required for testing" if $@;
19         all_files_no_breakpoints_ok();
20

DESCRIPTION

22       I love soft breakpoints ("$DB::single = 1") in the Perl debugger.
23       Unfortunately, I have a habit of putting them in my code during
24       development and forgetting to take them out before I upload it to CPAN,
25       necessitating a hasty fix/package/bundle cycle followed by much
26       cursing.
27
28       Test::NoBreakpoints checks that files contain neither the string
29       "$DB::single = 1" nor "$DB::signal = 1".  By adding such a test to all
30       my modules, I swear less and presumably lighten the load on the CPAN in
31       some small way.
32

FUNCTIONS

34       Unless otherwise noted, all functions are tests built on top of
35       Test::Builder, so the standard admonition about having made a plan
36       before you run them apply.
37
38   no_breakpoints_ok($file, [$description] )
39       Checks that $file contains no breakpoints.  If the optional
40       $description is not passed it defaults to "no breakpoint test of
41       $file".
42
43       If the test fails, the line number of the file where the breakpoint was
44       found will be emitted.
45
46       For compatibility with old versions of this module, the deprecated name
47       "no_brkpts_ok" may also be used (but see "DEPRECATED FUNCTIONS").
48
49   all_perl_files( [@dirs] )
50       Returns a list of all *.pl, *.pm and *.t files in the directories
51       listed.  If @dirs is not passed, defaults to "blib" and "t".
52
53       The order of the files returned is machine-dependent.  If you want them
54       sorted, you'll have to sort them yourself.
55
56   all_files_no_breakpoints_ok( [@files] )
57       Checks all files that look like they contain Perl using
58       no_breakpoints_ok(). If @files is not provided, it defaults to the
59       return of all_perl_files().
60
61       For compatibility with old versions of this module, the deprecated name
62       "all_files_no_brkpts_ok" may also be used (but see "DEPRECATED
63       FUNCTIONS").
64

EXPORTS

66       By default all_files_no_breakpoints_ok and no_breakpoints_ok.
67
68       For the time being, the deprecated forms the above
69       (all_files_no_brkpts_ok and no_brkpts_ok) are also exported (but see
70       "DEPRECATED FUNCTIONS").
71
72       On request, all_perl_files.
73
74       Everything with the tag :all.
75

DEPRECATED FUNCTIONS

77       Prior to v0.13 of this module, no_breakpoints_ok was called
78       no_brkpts_ok and all_files_no_breakpoints_ok was similarly abbreviated.
79
80       In v0.13, these older names were deprecated.  They are still exported
81       by default, but will emit a warning unless you disable the deprecated
82       lexical warning category:
83
84         {
85           no warnings 'deprecated';
86           no_brkpts_ok(...);
87         }
88
89       In the next release, the deprecated functions will have to be pulled in
90       via an import tag.  In the release after that, they will cease to be.
91

ACKNOWLEDGEMENTS

93       Michael Schwern for Test::Builder.
94
95       Andy Lester for Test::Pod, which is where I got the idea and borrowed
96       the logic of all_perl_files from.
97

BUGS

99       ·   doesn't catch some breakpoints
100
101           This is a valid breakpoint:
102
103             package DB;
104             $single = 1;
105             package main;
106
107           as is this:
108
109             my $break = \$DB::single;
110             $$break = 1;
111
112           but neither are currently caught.
113

TODO

115       ·   enhance regex to find esoteric setting of breakpoints
116
117           If you have a legitimate breakpoint set that isn't caught, please
118           send me an example and I'll try to augment the regex to match it.
119
120       ·   only look at code rather than the entire file
121
122           This is not as easy as simply stripping out POD, because there
123           might be inline tests or examples that are code in there (using
124           Test::Inline).  Granted, those should be caught when the generated
125           .t files are themselves tested, but I'd like to make it smarter.
126
127       ·   not use regular expressions
128
129           The ideal way to find a breakpoint would be to compile the code and
130           then walk the opcode tree to find places where the breakpoint is
131           set.  B::FindAmpersand does something similar to this to find use
132           of the $& in regular expressions, so this is probably the direction
133           I'm going to head in.
134

SEE ALSO

136       Test::Builder
137
138       Test::Pod
139

AUTHORS

141       ·   James FitzGibbon <jfitz@cpan.org>
142
143       ·   Apocalypse <APOCAL@cpan.org>
144
145       ·   Chisel <chisel@chizography.net>
146
148       This software is copyright (c) 2012 by James FitzGibbon and Chisel
149       Wright.
150
151       This is free software; you can redistribute it and/or modify it under
152       the same terms as the Perl 5 programming language system itself.
153
154
155
156perl v5.32.1                      2021-02-24            Test::NoBreakpoints(3)
Impressum