CPAN modules for checking credit card numbers (LUHN check)

I have published a review of CPAN modules for checking credit card numbers, using the LUHN algorithm. There are nine modules listed, with seven of them able to do a LUHN check on an arbitrary number (one of the other modules is vaporware from Steven Haryanto!)

I've also updated the review of modules for defining constants: a new version of Const::Fast was released today.

Should my Perl release process be yours?

Steven asks "What is your release process". I could have buried my thoughts in the comments, but Dean Hampstead suggested it as a topic for the second edition of Mastering Perl. I started to respond there, but that got a little out of hand too. Whereas Learning Perl and Intermediate Perl are much more "do what I show you because you're new", Mastering Perl is much more "why do we do this?".

There are two opposing ways to go with any process. Your process can be completely external to the actual distribution so that nothing in the distribution is set up to support the process or its automation.

Or, you can create a process and make your distribution match that.

You choose the one that works for you. Don't jump into something without thinking about the long term consequences. Think about it for the next week, no matter what you are doing, whether at work or during a hobby or whatever you do. What's deciding how you do something?

Galileo and websockets

While I have been on vacation, I have found a little time to add some polish to Galileo, my recently released CMS. Recent additions include a utility for writing a mostly generic configuration file and administrative popups which explain how to create new pages or add new users. The most important thing I have added though is some more setup-time documentation! Hopefully people will now find it even easier to get a Galileo-based CMS up and running.

In writing the documentation, however, I was faced with a question that I do not know the answer to: do any other plack-based or otherwise Mojolicious compatible Perl webservers (i.e. plackup, starman, twiggy etc) support websockets? While in principle a Mojolicious app can run under all of these, Galileo depends heavily on websockets, especially for content editing.

If any of you know, please comment.

I have more ideas for improvements to Galileo, but they will take a little more work than I want to put in here on vacation. In the meantime it is still very functional, go take a peak. :-)

Blio - my blogging "engine"

.. you can read about Blio on my Blio powered blog...

ThreadSanitizer

Time for a new tool - tsan

http://code.google.com/p/data-race-test/wiki/ThreadSanitizer

See this pasty http://pastebin.com/gKRDTkh3 how I successfully analyzed a hairy race in parrot's new threads branch. This problem was a big blocker for parrot developers, as described in http://lists.parrot.org/pipermail/parrot-dev/2012-August/007078.html.

To catch common memory errors you simply have to use the new clang -faddress-sanitizer, along these instructions in perlhacktips.pod or use valgrind. But to detect race conditions tsan is another gold-mine from google's moscow lab. This is the old valgrind based version:

cd ~/bin; wget http://build.chromium.org/p/client.tsan/binaries/tsan-r4356-amd64-linux-self-contained.sh; chmod +x tsan-r4356-amd64-linux-self-contained.sh; cd -

*runloop_id_counter race with threads, t/pmc/task.t * https://github.com/parrot/parrot/issues/808

Schedule for YAPC::Europe 2012 is online

After hard work and many trade-offs, we have finished the schedule for this years YAPC::Europe. Find the three days on the YAPC::Europe website (iCal export).

Unfortunately it is likely that there still are talk conflicts where you would like to attend two or more talks at the same time. We are recording some of the tracks, so hopefully you can watch the talks you missed after the event.

What is your release process?

For me, it goes something like this.

First, I edit Changes and dist.ini. Some people automate filling their Changes entry from 'git log', I find this inappropriate since Changes are meant for users, not developers. I also still bump version number manually (though only in one place, dist.ini). Perhaps someday I'll automate it; my version numbering scheme is mostly a boring 0.01-increments anyway.

This modification to two files will be in the commit message that marks the release.

Then I "push the one-click release process button", by running a simple Perl script, without any arguments, in the dist's top-level directory. Thanks to Dist::Zilla, the script is fairly simple. It just needs to:

Experienced Perl Developer sought by Lokku Ltd (Nestoria)

(cross-posted from jobs@london.pm.org)
------------------------------------------------------------

Hi guys and girls,

We're looking for a Perl developer with 2+ years of experience programming
professionally to join our engineering team in central London, primarily to
work on the Nestoria property search engine (http://www.nestoria.com)

Nestoria is a great product to work on. As a vertical search engine we work
hard to solve many of the same problems as a larger search company:

  • Reliably and quickly processing millions of listings
  • Even more quickly searching those listings at query time
  • Tracking user behaviour and always improving the user experience
  • Internationalization - we work in eight countries with six languages
  • Geocoding, Natural Language Processing, Image Processing, Historical, House Price Aggregation, Mobile Web...


We are looking for somebody who has:

  • 2+ years' experience as a professional Perl programmer
  • Strong knowledge of Perl best practices and modern Perl development practices
  • Excellent technical communication skills
  • A desire to coach, mentor and share your experience with junior team members


We're offering c. £45K plus bonus.

To gdb or not to gdb?

Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles

Spoiler alert: the answer is 1 or true

Before delving back in the next planned blog post of another important nuts-and-bolts Devel::Trepan topic — position and status information — I'd like to take a step back and talk a little bit philosophical like I did in the first blog.

In that blog, I wrote something a bit contradictory. I wrote that I wrote Devel::Trepan to follow gdb. But at the end of the blog I wrote that I wanted it to be more of a platform for (cough, cough) research.

Social Event at Depot 1899 in Frankfurt am Main

On the evening of the first day of the conference, we will hold the Social Event
at the Depot 1899 in the lovely Sachsenhausen part of Frankfurt.
Here you will be able to wind down from a day of talks with a buffet.

We arranged a bus transfer from the University to Sachsenhausen. As Sachsenhausen is
close to the city centre, you may want to finish the day by taking a walk
through Sachsenhausen back to your hotel or by taking the bus transfer
or a tram back to the university.

Processing schema.org markup with Perl

Someone on IRC asked me for an example of how to parse schema.org markup using my HTML::HTML5::Microdata::Parser module. So here one is. It pulls the microdata from the page, and queries it using SPARQL.

#!/usr/bin/env perl

use HTML::HTML5::Microdata::Parser;
use LWP::Simple 'get';
use RDF::Query;

my $uri = "http://buzzword.org.uk/2012/schema-org.html";
my $microdata = HTML::HTML5::Microdata::Parser->new(
   get($uri),
   $uri,
);

my $query = RDF::Query->new(<<'SPARQL');
PREFIX schema: <http://schema.org/>
SELECT ?name ?page
WHERE {
   ?person
      a schema:Person ;
      schema:name ?name ;
      schema:url ?page .
}
SPARQL

my $people = $query->execute($microdata->graph);

while (my $person = $people->next)
{
   printf(
      "Found person: %s %s\n",
      $person->{name},
      $person->{page},
   );
}

Marpa v. Perl regexes: a rematch

Marpa::R2, the latest version of Marpa, has some significant speedups. Enough so, that it seems appropriate to revisit an old benchmark. (For those new to this blog Marpa is a new parser with a decades-long heritage. Marpa parses anything you can write in BNF and, if your grammar is in one of the classes currently in practical use, parses it in linear time.)

The benchmark I'll revisit compared Marpa to Perl regexes, testing the speed with which each could find balanced sets of parentheses in a string of parentheses, on a first longest match basis. It's an interesting test, because it has easy cases and hard cases, and because the dividing line between good applications for Marpa and good applications for regexes is somewhere between the two sets of cases.

In the "hard cases", the matches come toward the end. On these, Perl regexes go quadratic (O(n2)), while Marpa stays linear. When Perl regexes become unuseable depends on your hardware and your patience, but there does come such a point.

origami envelopes

I've always been fond of origami, and in some periods I also had time to fold some as a hobby. Alas, this is not the case any more... most of the times.

I'm also proud to produce my greeting cards for birthdays and occasions, when I remember to actually make one (which happens seldom... but happens). Some time ago I stumbled upon a neat design for an origami envelope - although I don't remember where I saw it, I've found a couple of web sites that include it (e.g. here). So... two of "my" things coming together...

Then I'm fond of Perl, of course. So why not kicking it in and use it to add an image to the back of the envelope... automatically?

When Perl is not applicable

The story repeats again and again, and there's a single conclusion I can make out of that: never do large data aggregation in SQL and Perl.

This time I had a Perl script which builds a standard business report: lots of items show their performance by week, month, quarter etc. Thus you've got a few big two-dimensional tables where one axis is time and another one contains data item names. Say, from the beginning of the year there are about 30 weeks past today, eight months, two quarters. These are three tables with weeks, months and quarters on their time axis.

Basically, all you need is sum(field), count(field) where date between date1 and date2, applied to every type of data you've got in the system. In my case it was about a few million records with 10-20 parameters in each.

Agile Companies?

I've been doing some research into how different companies operate and I was curious if people would be kind enough to give me examples of companies they would consider "agile" in overall company organization, project management, or some other aspect. For example, I've heard some companies update their live site when devs push their changes to the main branch. That would be far more agile than than the typical change management process most companies require. Other companies avoid project managers under the premise that projects requiring managers have grown too complex.

If you can think of any examples, I would love to see them. Links would be helpful as I'd like to be able to do some more digging.

On a completely related note: I'm finding most studies on how successful companies are run are full of crap.

New Project: ziprip.js

I've been playing with JS a bit recently, and have released a client-side library for extracting postal addresses and geocoords from webpages - it's intended for use in bookmarklets and browser extensions:

http://zipripjs.com/

I've also made it work with node.js - which means it's installable via npm. For what it's worth, it's considerably easier to create a new user account for node packages (no human intervention step), and there's a built-in publish tool...

YAPC::NA 2012 - The Survey Results

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

Many thanks to the 165 respondents, who made up 37% of the attendees. Although the responses only feature a third of the attendees, they do appear to cover a complete mix of experience, and present a good cross-section of attendees. As has been observed in previous years the average age of the attendees is getting older. That's not to say we aren't bringing new people into the community and the conference circuit, but it seems that Perl is a language people are getting into enough to attend events like this from their late twenties. In 2012, YAPC::NA had it's biggest attendance so far, so Perl is definitely growing its community. Hopefully events like YAPC are encouraging more and more people to learn more about Perl and the community. Looking at the demographics of the respondents, it's not too surprising to see the popular job roles and industries listed. However, it is encouraging to see Perl is being used in many different industries.

AnyEvent::Capture - Synchronous calls of async APIS

Cage7.jpg I’ve been a busy little bee lately, and have published a handful of new CPAN modules— I’ll be posting about all of them, but to start things off, I bring you: AnyEvent::Capture

It adds a little command to make calling async APIs in a synchronous, but non-blocking manner easy. Let’s start with an example of how you might do this without my shiny new module:

 use AnyEvent::Socket qw( inet_aton );

 my $cv = AE::cv;
 inet_aton( 'localhost', sub { $cv->send(@_) });
 my @ips = $cv->recv;
 say join ".", unpack("C*") for @ips;

The above is not an uncommon pattern when using AnyEvent, especially in libraries, where your code should block, but you don’t want to block other event listeners. AnyEvent::Capture makes this pattern a lot cleaner:

Updates to five of my CPAN reviews

I've updated five of my CPAN reviews, adding new modules and updating where new versions of modules have been released.

I've added the ability to comment at the end of each review, using disqus. Following a suggestion from Ben Bullock, module names in the summary table now link to the review section for the module, and there's a separate link for the module's doc.

Devel::Trepan Debugger evaluation of Perl statements

In the last blog, I started describing features that are new in Devel::Trepan that aren't in perl5db. Here I will continue with one more: the evaluation aspects of the debugger REPL (read, eval, and print loop).

By default, when you type something that isn't a debugger command the debugger just tries to evaluate the string you gave it. If what you typed was really a mistyped debugger command you might get a weird error message. For example:


(trepanpl): stp
Unquoted string "stp" may clash with future reserved word ...

If you don't want this behavior, you can turn off "auto eval". And here is what happens then:

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.