The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DB::Color - Colorize your debugger output

VERSION

Version 0.20

SYNOPSIS

Put the following in your $HOME/.perldb file:

 use DB::Color;

Then use your debugger like normal:

 perl -d some_file.pl

If you don't want a $HOME/.perldb file, you can do this:

 perl -MDB::Color -d some_file.pl

DISABLING COLOR

If the NO_DB_COLOR environment variable is set to a true value, syntax highlighting will be disabled.

WINDOWS

No, sorry. It's a combination of bad Windows support for ANSI escape sequences and bad debugger design.

PERFORMANCE

When using the debugger and when you step into something, or continue to a breakpoint in a new file, the debugger may appear to hang for a moment (perhaps a long moment if the file is big) while the file is syntax highlighted and cached. The next time the debugger enters this file, the highlighting should be instantaneous.

You can speed up the debugger by using the perldbsyntax program which is included in this distribution. It will pregenerate syntax files for you.

Syntax highlighting the code is very slow. As a result, we cache the output files in $HOME/.perldbcolor. This is done by calculating the md5 sum of the file contents. If the file is changed, we get a new sum. This means that syntax highlighting is very slow at first, but every time you hit the same file, assuming its unchanged, the cached version is served first.

Note that the cache files are removed after they become 30 (but see config) days old without being used. If you use the debugger regularly, commonly debugged files will load very quickly (assuming they haven't changed).

CONDITIONAL LOADING

If you prefer, you may only want to have some of your projects "colorized". If so, you can do something like this:

    use DB::Color sentinel => '.colorize';

If an if the .colorize sentinel (or whatever you named it) does not exist, DB::Color will not be used.

WORKFLOW

To use DB::Color effectively, I recommend the following:

    $ 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.

CONFIGURATION

You can optionally configure DB::Color by creating a $HOME/.perldbcolorrc configuration file. It looks like this:

 [core]
 
 # the class that will highlight the code
 highlighter = DB::Color::Highlight
 
 # Any cache file not accessed after this number of days is purged
 cache_max_age = 30
 
 # where to put the cache dir
 cache_dir   = /users/ovid/.perldbcolor
 

The above values are more or less the defaults for this module. They are all optional.

ALPHA

This is only a proof of concept. In fact, it's fair to say that this code sucks. It's not very configurable and has bugs. It's also going to possibly be a memory hog, as if the debugger wasn't bad enough already.

AUTHOR

Curtis "Ovid" Poe, <ovid at cpan.org>

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/Ovid/DB--Color/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc DB::Color

You can also look for information at:

ACKNOWLEDGEMENTS

Thanks to Nick Perez, Liz, and the 2012 Perl Hackathon for helping to overcome some major hurdles with this module.

LICENSE AND COPYRIGHT

Copyright 2011 Curtis "Ovid" Poe.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.