The sad state of syntax highlighting libraries on CPAN

I just posted reviews of several code syntax highlighting libraries on CPAN. In short, most of them are crap and there is nothing remotely similar to Python's Pygments or Ruby's coderay (oh how the mighty CPAN has fallen). I found that Syntax::SourceHighlight, a Perl interface to GNU Source-highlight, is the only usable one. One downside is just that I need to pull over 100MB-worth of Debian packages to have it installed, a huge dependency especially since my original requirement is merely to colorize the terminal output of some JSON and YAML. And it's too bad that it doesn't support YAML out-of-the-box yet. So I don't plan on using it anytime soon.

Currently I'm investigating (via the lazy web) utilizing emacs'/vim's syntax-highlighting capability. It's a good bet that one of those two editors are available on a standard Linux box. A pure-Perl library would be ideal though.

Filters with Template Toolkit

In the last days I've been preparing a web site where I want to show values in four different currencies, accordingly with the user choice, and keeping up with the current exchange quote. I do not want to talk about how to get those values, or what values or website I am building, but just share an experience I've got with Template Toolkit that made it easy to separate the values conversion from the core code.

Patch known perlcore ptr problems

App::perlall 0.27, a better perlbrew at CPAN for multiple global perls, now patches some of the known security problems with buffer-overflows and use-after-free errors for the perl production releases.

E.g. perlall build 5.14.2-nt builds a patched non-threaded perl, with proper entries in patchlevel.h. A proper 5.14.3d-nt-asan not yet.

I currently patch only 4 known errors for non-threaded perls from 5.10 to 5.16. The latest "security fix" 5.14.3, blead and threaded perls are in a worse shape. I will add more fixes to App::perlall for these perls later. The amount of work is overwhelming. There are at least 2 more buffer-overflows and use-after-free errors which need to be backported.

The details are in a Devel::PatchPerl plugin called Devel::PatchPerl::Plugin::Asan

Promoting Perl Workshops and Conferences

I'd like to thank all the Perl Workshop, YAPC and OSDC organizers who were kind enough and posted a Perl Weekly banner on their sites.

I maintain a list of future Perl Workshops and conferences, and include the 3-4 closest ones in every edition of the newsletter. If you would like to see your event listed there, and sent out to over 4,000 people, please let me know.

Three Command-Line Utilities

So, November is NaNoWriMo ("National Novel Writing Month"), and I was hoping to get some serious writing done (instead of coding), but I kept being distracted with coding and random writing in various Internet forums. Well, hopefully this blog post will compensate a little for that.

In this post, I'd like to cover three command-line utilities - two of them new and were written by me, and one of them somewhat older, but also written in Perl.

The first utility is GNU Parallel, which allows one to run several command-line jobs in parallel, using forking and/or ssh remote logins. I used it to speed up some processing I've been doing on my computer. For more information and some examples of usage, see my post about it to the linux-elitists mailing list, and also read Thomas Sattler's response which provides some further insights.

On the utility of Module::Build::CleanInstall

Not too long ago, I asked for input on a new module: Module::Build::CleanInstall.

TL;DR its out there, go use it!

Filtering CPAN results by release date

When is the last time you used a CPAN distribution whose last release date was more than five years ago? I don't mean just in hacking around or for research purposes. I'm talking about something that mattered, that lived somewhere other than your development machine and could be seen/used by other people. Even if you have an answer for me, it's certainly going to be the single exception to a vastly superior rule, no?

For the vast majority of my searches, I really couldn't give a fluff about anything last released in 2007 or earlier. I'm not advocating removal or anything (or am I?) but the language and its developers move on. Shouldn't CPAN?

Announcement for Sereal, a binary data serialization format, finally live!

It's been long in the making, but finally, I've gotten the Sereal announcement article in a shape that I felt somewhat comfortable with publishing. Designing and implementing Sereal was a true team effort and we really hope to see non-Perl implementations of it in the future. We're virtually committed to finish the Java decoder at least for our data-warehousing infrastructure. Any help and cooperation is welcome, as are patches to improve the actual text of the specification (which is kind of a weak point still).

By the way, for those who worried about the lack of a comment-system on the Booking.com dev blog before, we've added Disqus-support.

But now, I'm just glad it's out there!

Problems building mod_perl on Mountain Lion (MacOSX 10.8)

Over the weekend I upgraded my laptop to Mountain Lion, and decided to install Perl 5.16.2. I had problems getting mod_perl working. This is a summary of the problem and the (a?) solution, in the hope it might save others from banging their heads against it.

A Marpa tutorial: pattern searches

[ This is cross-posted from the new home of the Ocean of Awareness blog . ]

Pattern searches

We use regular expressions for pattern searching these days. But what if your search target is not a regular expression? In this post I will show how to use Marpa to search text files for arbitrary context-free expressions.

This tutorial builds on earlier tutorials. It is possible to simply dive into it, but it may be easier to start with two of my earlier posts, here and here.

The grammar

I will use arithmetic expressions as the example of a search target. Even the arithmetic subset of Perl expressions is quite complex, but in this case we can get the job done with eight lines of grammar and a lexer driven by a table of just over a dozen lines. Here is the grammar:

    
start ::= prefix target
prefix ::= any_token*
target ::= expression
expression ::=
       number | scalar | scalar postfix_op
    || op_lparen expression op_rparen assoc => group
    || unop expression
    || expression binop expression`
    
    

YAPC::Europe 2013 in Kiev, week minus 40. Announcing the Venue

Today we announce that the YAPC::Europe 2013 in Kiev will be held in the Ukrainian House national centre, a five-storey building in the very centre of Kiev.

image06.png

Let's first give a word to the official site of the venue.

Sparklines in Excel::Writer::XLSX

I've added Sparklines to the latest version Excel::Writer::XLSX.

Sparklines are small charts showing trends that fit in a single cell. They were invented (or at least named) by Edward Tufte.

In Excel they look something like this:

sparklines1.jpg

Excel::Writer::XLSX now provides an interface to Sparklines in Excel and to all of their options to allow worksheets like the following (taken from the output of one of the example programs):

sparklines2.jpg

On a related note, I also recently added Excel "Tables" to Excel::Writer::XLSX. Excel Tables are a way of grouping a range of cells into a single entity that has common formatting or that can be referenced from formulas:

tables.jpg

YAPC::Europe 2012 - The Survey Results

The Conference Survey Results for YAPC::Europe 2012 are now online.

Many thanks to the 124 respondents, who made up 37% of the attendees. Although we usually experience a greater response from European attendees, the responses we did get still give a reasonable picture of the attendees. Once again it seems the attendees are getting older with the average age of an attendee being in their mid-30s. For a good proportion of the respondents this was their first YAPC, so we are still encouraging newcomers to get more involved in Perl community events. With 327 attendees in total this was the 3rd highest attended European YAPC (only just behind Vienna (340) and Lisbon (330)).

Perl 5 Porters Weekly: October 29-November 4, 2012

Welcome to Perl 5 Porters Weekly, a summary of the email traffic of the perl5-porters email list.

This week's topics are:

  • perl-5.16.2 is now available
  • perl-5.12.5 RC1 is now available
  • What happened to the whole "small core" idea?
  • Eliminating the "rehash" mechanism for 5.18
  • benchmarking Murmurhash3 vs One-At-A-Time as perl's hash function

Windows port of Marpa::R2

A very good thing indeed. Can't wait to get my hand on it.

Install all metacpan favorited distributions

Today I had to install fresh Perl on one of my dev boxes and I was thinking if there is easy way to grab and install all of mine favorited distributions on metacpan.

I wrapped that into simple script, that reads all the favorited distributions from metacpan, using Mojo::UserAgent and installs them using cpanm.

Here is the script: https://gist.github.com/4030168

30 url mappers for Google code-in

Hi

Here's a list of 30 url mappers I'd like to treat as per the list of 122 class builders. Please comment re adds or deletes, evaluation criteria, whatever.

Catalyst::Dispatcher
CGI::Application::Plugin::ActionDispatch
CGI::Application::Plugin::REST
CGI::Application::Plugin::Routes
CGI::Application::URIMapping
Dancer::Plugin::Dispatcher
Dancer::Route
Forward::Routes
HTTP::Router::Route
Jifty::Dispatcher
Mojolicious::Routes
Path::Dispatcher
Path::Router
Pickles::Dispatcher
Pinwheel::Mapper
Plack::App::Path::Router
Plack::App::Path::Router::PSGI
Plack::App::URLMap
PlackX::RouteBuilder
REST::Application::Routes
Router::Dumb
Router::Generic
Router::Simple
Routes::Tiny
Scaffold::Routes
Silki::Action::REST
Sleep::Routes
Web::API::Mapper
Web::Dispatcher::Simple
Web::Simple

Omitted: Apache-specific, FCGI-specific, Engine X-specific.

Writing version of dependencies

Sometimes excess laziness is not a virtue. Whenever I add a dependency, I used to just write in dist.ini:

Foo::Bar=0

This is of course not correct. Starting from last week, I've changed this habit. now I write the version which was currently installed on my development laptop/PC at the time of writing. And if I am not lazy, I try "cpanm Foo::Bar" first to update it to the latest version.

A Parser for Marpa::R2

This proof-of-concept (test, module) parser takes input, invokes lexer as needed, evaluates parse tree(s) and returns the value.

CPAN Testers Summary - November 2012 - Kick

If I could kick the Amazon SimpleDB we have, I'd take great delight in doing so. Thankfully, our days of relying on it are numbered ... in a good way. More news on this will be forthcoming soon.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.