File Coverage

blib/lib/Devel/FileBreaker.pm
Criterion Covered Total %
statement 2 2 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 3 3 100.0


line stmt bran cond sub pod time code
1             package Devel::FileBreaker;
2             our $VERSION = 0.02;
3             sub import {
4 1     1   9 our @patterns = @_[1..$#_];
5 1         14 require "perl5db.pl";
6             }
7             CHECK { # expect compile-time mods have been loaded before CHECK phase
8             while (my ($sub,$file) = each %DB::sub) {
9             $file =~ $_ and DB::cmd_b_sub($sub), last for our @patterns;
10             }
11             }
12             1;
13              
14             =head1 NAME
15              
16             Devel::FileBreaker - set breakpoints in all subroutines in one or more files
17              
18             =head1 VERSION
19              
20             0.02
21              
22             =head1 SYNOPSIS
23              
24             $ perl -d:FileBreaker=file1,regexp2 script_to_debug.pl
25              
26             =head1 DESCRPITION
27              
28             C seeks to simplify the process of settings breakpoints
29             in a collection of subroutines in a Perl source file or set of files.
30              
31             This module was inspired by a
32             L.
33              
34             =head1 USAGE
35              
36             To use this module, pass this command-line argument to C
37              
38             -d:FileBreaker=pattern[,pattern2[,...]]
39              
40             where C, C, etc. are any valid perl regular expressions.
41             In the L<< C phase|perlmod/"BEGIN,-UNITCHECK,-CHECK,-INIT-and-END" >>
42             of the program, a breakpoint will be set at the start of any subroutine
43             defined in a file name (given by the values of
44             L<< C<%DB::sub>|DB/"%DB::sub" >>) that matches one of the given regular expressions.
45             This includes any anonymous subroutines defined in the files
46             that are known at compile time.
47              
48             =head2 EXAMPLES
49              
50             =over 4
51              
52             =item * Set a breakpoint in all subs in the module C and all
53             C submodules:
54              
55             perl -d:FileBreaker=Floop/Blert ...
56              
57             =item * Set a breakpoint in all subs just in module C:
58              
59             perl -d:FileBreaker=Floop/Blert.pm ...
60              
61             =item * Set a breakpoint in every known subroutine:
62              
63             perl -d:FileBreaker=^ ...
64              
65             =item * Set a breakpoint in all subroutines from one of your subdirectories
66              
67             perl -d:FileBreaker=$HOME/site_perl/mylib ...
68              
69             =back
70              
71             =head1 SUPPORT
72              
73             This module is part of the L distribution.
74             See L for support information about this module.
75              
76             =head1 SEE ALSO
77              
78             L, L
79              
80             =head1 AUTHOR
81              
82             Marty O'Brien, Emob at cpan.orgE
83              
84             =head1 LICENSE AND COPYRIGHT
85              
86             Copyright 2018 Marty O'Brien
87              
88             This program is free software; you can redistribute it and/or modify it
89             under the terms of either: the GNU General Public License as published
90             by the Free Software Foundation; or the Artistic License.
91              
92             See http://dev.perl.org/licenses/ for more information.
93              
94             =cut