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