Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Friday June 06, 2003
12:38 PM

Debugger done

[ #12662 ]

The debugger has now been commented, top to bottom.

It was an interesting job, and well worth doing. Not only did I learn a lot, but something that others will be able to use has come out of it. In addition, I learned a lot about how to check a vastly re-commented, re-whitespaced source against the original. For those interested:

  1. Install perltidy .
  2. Edit, edit edit. If you're going to try to clean up code, perltidy it now. The default settings yield very nice source.
  3. Once editing is complete, copy the source and edited versions elsewhere.
  4. Run this on both copies of the old and new source:

        perltidy -syn -dsm -naws -dnl -sob -dac -ce -bar

    This will syntax-check the output, delete extra null statements, don't add whitespace, delete old newlines and re-break, "swallow" optional blank lines, delete all comments, cuddled elses, opening brace always on right
  5. diff -ua the resulting code, piping it through

        perl -p -e 'next if /^[\+\-]\s*$/'

You can now visually inspect the output, looking for dropped stitches. This works particularly well for catching pod blocks with missing =cuts, as the old code will show up as deleted from the output code.

It might be worthwhile to consider some code-comparison enhancements to perltidy; even with the command line given above, lines with their internal spacing changed will still show up as different.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Good Job! Doubly so for having the gumption to see a problem, attempt to fix it, and succeed all on your own.


    We all owe you some beers this summer. What's your favorite?

    • I loved the stuff at the Church Brewpub in Pittsburgh; we'll have to see what's cookin' in Portland. :)
  • Couldn't you use -b or -w when you run diff to avoid seeing whitespace changes?
    • -w seemd to help some (thanks!), but newlines are still a problem here and there. More fiddling with perltidy might do it.

      I think the real problem is that it's not easy to parse perl and do a real semantic diff.