March 2012 Archives

Major DB::Color update (Perl QA Hackathon)

After my previous announcement of DB::Color, I've not had much time to work on it. I eventually disabled it on my box because it was broken on many common cases. Thanks to the Paris Perl QA Hackathon, I've solved a few nasty bugs and now I'm happily using it to debug Perl.

There are some caveats.

Syntax highlighting is slow and is broken in a few edge cases. To get around the first issue, I have naïve caching of syntax highlighted files (change the files and the MD5 sum differs and you get a new cache). Any cached file not used in the last 30 days is deleted.

The broken syntax highlighting has resulted in several bug reports for Syntax::Highlight::Engine::Kate.

My favorite bit (cough) with how I replace lines of code with the syntax highlighted versions is this:

Read that last comment. That's the sort of subtle issues that keep tripping me up while I write this. The latest release is on Github and will shortly hit CPAN.

Hacking on Dancer

If you're not familiar with Dancer, it's a Perl framework written by Alexis Sukrieh and inspired by Ruby's Sinatra framework. Though some call it a "micro-framework", according to Wikipedia, Sinatra is used by Apple, BBC, the British Government, LinkedIn, Engine Yard, Heroku, GitHub, and Songbird. That impressive list shows that Sinatra, and thus Dancer, is far more powerful than you might think at first glance.

So far, while I love Catalyst, I've found that I'm hacking out a Web service much faster with Dancer than I would have with Catalyst and I used Catalyst quite a bit. I've submitted a couple of minor patches, but I'm very happy with my latest enhancement to Dancer.

Kickin' it old school

I'm sure you remember the good ol' days of typing programs straight out of a book hoping to see something which looks like this:

                     *
                 *   *  *
              *  *   *  *   *
          *   *  *   *  *   *  *
          *   *  *   *  *   *  *
          *   *  *   *  *   *  *
       *  *   *  *   *  *   *  *   *
       *  *   *   *  *   *  *  *   *
       *  *   *   *   *  *  *  *   *
   *   *  *   *    *  *   * *  *   *  *
   *   *  *    *   *    * *  * *   *  *
   *   *   *   *     *   *  **  *  *  *
   *   *   *    *      *    * * *  *  *
   *   *   *     *       *    * *  *  *
   *   *   *      *        *      **  *
   *   *    *       *         *       *
   *   *    *        *           *       *
   *   *     *         *            *        *
   *   *     *          *             *         *
   *   *     *          *               *         *
*  *   *     *           *              *          *
   *   *     *          *               *         *
   *   *     *          *             *         *
   *   *     *         *            *        *
   *   *    *        *           *       *
   *   *    *       *         *       *
   *   *   *      *        *      **  *
   *   *   *     *       *    * *  *  *
   *   *   *    *      *    * * *  *  *
   *   *   *   *     *   *  **  *  *  *
   *   *  *    *   *    * *  * *   *  *
   *   *  *   *    *  *   * *  *   *  *
       *  *   *   *   *  *  *  *   *
       *  *   *   *  *   *  *  *   *
       *  *   *  *   *  *   *  *   *
          *   *  *   *  *   *  *
          *   *  *   *  *   *  *
          *   *  *   *  *   *  *
              *  *   *  *   *
                 *   *  *
                     *

perlfind - perldoc on steroids

Every time I use perldoc for any term slightly unusual, I struggle. Have you tried to use it to find UNITCHECK? Now you can. Instead of remembering which of these to use (and none of these will find UNITCHECK):

You can just type:

perlfind --all UNITCHECK

In the last case above, the --all is needed to do a brute force search. Ordinarily, you just do perlfind searchterm, regardless of whether it's a module name, function, variable, or faq keyword and it will return the first result found (searched in the order I just mentioned). Otherwise, it will tell you to use --all if you really want a brute force search to find out where that term is used.

Here's a gist I tossed out there. Patches welcome. I should bundle this up and put it on the CPAN (and handle older perldoc versions).

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/