File Coverage

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


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