in reply to break on warning in debugger
You can use some trickery and get the warning to kick the debugger into single-step mode:
use strict; use warnings; $SIG{__WARN__} = sub { $DB::single = 1 }; my $c = 3; my $d = 'foo'; my $e = $c + $d; print "$e\n";
This will stop the program after the warning that caused the error (the addition of $c and $d). It is a much more difficult proposition to stop the program before the warning. Then again, this is probably sufficient 99.99% percent of the time.
Note that you still have to run the program under the debugger: perl -d myprogram. The gain is that you just have to <r>un the program, and it will churn away until a warning is raised.
• another intruder with the mooring in the heart of the Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: break on warning in debugger (r<c)
by tye (Sage) on Sep 25, 2007 at 15:27 UTC |