File Coverage

blib/lib/Devel/ModuleBreaker.pm
Criterion Covered Total %
statement 5 5 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 7 7 100.0


line stmt bran cond sub pod time code
1             package Devel::ModuleBreaker;
2             our $VERSION = '0.02';
3             sub import {
4 1     1   9 our @modules = @_[1..$#_];
5 1         3662 require "perl5db.pl";
6             }
7             CHECK {
8             for my $module (our @modules) {
9 1     1   610 no strict 'refs';
  1         2  
  1         100  
10             defined &{"$module\::$_"} and DB::cmd_b_sub("$module\::$_")
11             for keys %{"$module\::"};
12             }
13             }
14             1;
15              
16             =head1 NAME
17              
18             Devel::ModuleBreaker - set breakpoints for every subroutine in a namespace
19             simultaneously
20              
21             =head1 VERSION
22              
23             0.02
24              
25             =head1 SYNOPSIS
26              
27             $ perl -d:ModuleBreaker=Module1,Another::Module2 script_to_debug.pl
28              
29             =head1 DESCRPITION
30              
31             C seeks to simplify the process of settings breakpoints
32             in a collection of subroutines from one or more modules, without having to
33             enumerate the list of subroutines in the modules.
34              
35             This module was inspired by a
36             L.
37              
38             This distribution also comes with the packages
39              
40             =over 4
41              
42             =item L
43              
44             to automatically set breakpoints in any compile-time subroutine whose name
45             matches a regular expression
46              
47             =item L
48              
49             to automatically set breakpoints in any compile-time subroutine loaded from
50             a filename that matches a regular expression
51              
52             =back
53              
54             =head1 USAGE
55              
56             To use this module, pass this command-line argument to C
57              
58             -d:ModuleBreaker=pattern[,pattern2[,...]]
59              
60             where C, C, etc. are any valid perl regular expressions.
61             In the L<< C phase|perlmod/"BEGIN,-UNITCHECK,-CHECK,-INIT-and-END" >>
62             of the program, a breakpoint will be set at the start of any subroutine
63             whose fully qualified subroutine name (given by
64             L<< C<%DB::sub>|DB/"%DB::sub" >>) matches one of the given regular expressions.
65             This includes anonymous subroutines that are known at compile time.
66              
67             =head2 EXAMPLES
68              
69             =over 4
70              
71             =item * Set a breakpoint in all subs just in module C:
72              
73             perl -d:ModuleBreaker=Floop::Blert ...
74              
75             =back
76              
77             =head1 SUPPORT
78              
79             You can find documentation for this module with the perldoc command.
80              
81             perldoc Devel::ModuleBreaker
82              
83             You can also look for information at:
84              
85             =over 4
86              
87             =item * RT: CPAN's request tracker
88              
89             L
90              
91             =item * AnnoCPAN: Annotated CPAN documentation
92              
93             L
94              
95             =item * CPAN Ratings
96              
97             L
98              
99             =item * Search CPAN
100              
101             L
102              
103             =back
104              
105             =head1 SEE ALSO
106              
107             L, L
108              
109             =head1 AUTHOR
110              
111             Marty O'Brien, Emob at cpan.orgE
112              
113             =head1 LICENSE AND COPYRIGHT
114              
115             Copyright 2018 Marty O'Brien
116              
117             This program is free software; you can redistribute it and/or modify it
118             under the terms of either: the GNU General Public License as published
119             by the Free Software Foundation; or the Artistic License.
120              
121             See http://dev.perl.org/licenses/ for more information.
122              
123             =cut