Saturday, February 14, 2015

Perl Debugger Broken?

  DB<38> b 102 ($mod eq 'modn')
  DB<39> c
main::parametrize(./kitmaker.pl:204):
204:                    @compare_params = ($ref_line =~ /(?<!\w)((?:[0-9.]{2,}|[0-9]+)(?:e[+-]?\d+)?)/g );
  DB<39> p $mod
dn

See? Instead of stopping at 102, it stopped at 204. Wha??

Off topic, a gem from Marty O'Brien, die Meister :

If you've done a serious script and thumped your head trying to figure out what's going on, you know valuable it is to be able to stop-when-error-encountered - instead of using stupid things like b and c..

our $warn_flag = 0;
$SIG{__WARN__} = sub { $warn_flag = 1; CORE::warn(@_) };

...

for $i (1 .. 1_000_000_000) {
    do_something_that_might_warn();
    $DB::single ||= $warn_flag;
    $warn_flag = 0;
}

No comments: