Perl as CPAN glue

Quite a while I got interested in the idea of short, clear examples showing Perl as glue for CPAN. I recently refound these, and they caught my imagination:

Hiring Senior Devs in London

I'm hiring two positions in my team in lovely, sunny Canary Wharf (London)...

It took me a long time to write the job ads, so please have a good read! :-)


Subroutines that take more than a single argument should really be using something like MooseX::Params::Validate.


sub vivisect { 
    my ( $self, $args ) = @_;
    confess 'Expected a hashref of arguments' unless 'HASH' eq ref $args;

    my $hamster = $args->{hamster};

OK, so we know it accepts a hashref of arguments, and what's more, we know one of them is called hamster. But: what constitutes an acceptable hamster? What do we want to do if we don't have a hams…

Sequences, Sets, Bags, Functions

Groups of Items

A sequence is an ordered list of items, whose items aren't necessarily unique. Perl's arrays are sequences of a finite size:

my @sequence = qw/bar baz ban baz baz/;

A set, however, is an unordered collection of unique items. Perl provides native support for sets in the form of the keys of hashes:

my %set1 = map { $_ => undef } qw/foo bar baz/;
my %set2 = map { $_ => undef } qw/bar foo foo baz/; # Same as above
my %set3 = map { $_ => undef } qw/baz…

De Morgan's laws in Perl

We've been simplifying some ugly code recently, and De Morgan's laws have come up more than once. A developer on the team complained the Wikipedia entry obscured - from a developer's perspective - the simplicity of these quite useful transformation rules, so, expressed in Perl:

Given $p and $q as truth values:

(! ( $p && $q ) ) == ( (! $p) || (! $q) )
(! ( $p || $q ) ) == ( (! $p) && (! $q) )


NOT( p AND q ) is equivalent to (NOT p) OR  (NOT q)
NOT( p OR  q ) is equivalent to (NOT p) AND (NOT q)

So for example, say you come…