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

VERSION

9       version 0.15
10

SYNOPSIS

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

DESCRIPTION

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

FUNCTIONS

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

EXPORTS

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

DEPRECATED FUNCTIONS

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

ACKNOWLEDGEMENTS

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

BUGS

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

TODO

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

SEE ALSO

139       Test::Builder
140
141       Test::Pod
142

AUTHORS

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