Try Out Color Coded SQL

Thanks to arcanez, my color coding SQL Logging has been merged into DBIC’s master!

That means you can easily try out the new color coding! All you need to do to try it out is clone our master from git:

git clone git://

Make sure you install any new deps. The main one will be SQL::Abstract 1.68.

cpanm --installdeps .

And then use that as your lib directory when you run your server or whatever:

perl -I ~/DBIx-Class/lib scripts/ -rd

Now, you won’t notice a difference till you set the DBIC_TRACE_PROFILE variable. It sets the color profile to use. If you are on Linux and install the ANSIColor package, you probably want to set it to “console”. If you are in win32 or do no want to install ANSIColor, set it to “console_monochrome”. Both profiles fill in placeholders for you, for excellent readability, so that’s extremely helpful.

If you would like to make a nicer colorscheme, or more importantly want to use modern 256 color consoles, feel free! The documentation for that is available at SQL::Abstract::Tree. The best way to define one of those is to make a json file (I do ~/dbic.json) and populate it with the profile information you like, and then set DBIC_TRACE_PROFILE to the full path of the file. That way you can experiment with various profiles and when you think you have one that’s worth sharing, send it to me and I’ll probably merge it in!

Anyway, we hope to cut a new release in a week or two, with lots of other great new stuff, so feel free to wait if you’d prefer.

Posted Tue, Sep 21, 2010

Receive Blog Posts in Your Email