Improved Syntax Highlighting in the Debugger


You may recall me writing about DB::Color a few years ago . That module let you do this with the debugger:

It has some issues, including the fact that syntax highlighting Perl code is, um, not always perfect, but it does the job. The main drawback, however, is that it runs about as fast as a sloth with a spinal injury. It was so bad that even I stopped using it, and I love the damned thing. Today, I may have fixed that.

Version 0.20 is on github and wending its merry way to the CPAN . The docs now list a suggested workflow which looks sort of like this:

$ cpanm DB::Color$ echo "use DB::Color sentinel => '.colorize'" >> ~/.perldb# cd to project you want to colorize and create the sentinel$ touch .colorize# colorize the project. This will likely take a long time$ PERL5LIB=lib:t/tests perldbsyntax

At that point, you're almost good to go. However, as you're rapidly changing files, the debugger will still probably be very slow. Instead, create a watcher to watch your project directories and rehighlight any files which have been created or modified. An example of a watcher program is the examples/colorize program included with this distribution. It looks like this:

Basically, pass it a list of absolute paths, daemonize it, and it colorize files for you on the fly. So far it appears to be much fast than the original version.

Of course, you could provide your own highlighter, if desired.