SPUG: Is there a call that will break into the debugger?
Colin Meyer
cmeyer at helvella.org
Tue May 3 12:00:12 PDT 2005
On Tue, May 03, 2005 at 11:36:16AM -0700, James Moore wrote:
> Assuming that you've started your code under the debugger, is there a call
> it can make that will act as a breakpoint?
You can set the special variable $DB::signal to a true value.
-Colin.
For example:
> cat debug_test.pl
#!/usr/local/bin/perl
for (1..10) {
$DB::signal = 1 if $_ == 3;
print "$_\n";
}
> perl -d debug_test.pl
Loading DB routines from perl5db.pl version 1.28
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(debug_test.pl:3): for (1..10) {
DB<1> r
1
2
main::(debug_test.pl:5): print "$_\n";
DB<1> n
3
main::(debug_test.pl:4): $DB::signal = 1 if $_ == 3;
DB<1> n
main::(debug_test.pl:5): print "$_\n";
DB<1> n
4
>
> - James
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
> POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
> WEB PAGE: http://seattleperl.org/
More information about the spug-list
mailing list