Questioning the Role of API Design in Perl

or Querying the Designated API of Perl Roles

Planet Moose - March 2014

Welcome to Planet Moose, a brief write up on what's been happening in the world of Moose in the past month, for the benefit of those of you who don't have their eyes permanently glued to the #moose IRC channel, or the MetaCPAN recent uploads page.

If you'd like to contribute some news for next month's issue, you can do so on the wiki.

Moo

Although no new version of Moo has been released so far in 2014, there have been updates in March to a few of the modules it depends on:

Notice: forthcoming change to Type::Tiny overloading

One of the features of Type::Tiny that differentiates it from Moose's built-in type constraint system is that it allows stand-alone coercions which can then be mixed with type constraints as required. So if you had a Split coercion which split a multi-line string into an arrayref of lines, you could do something like this:

use MyApp::Types qw( ArrayRef Split );
 
has lines => (
   is      => 'ro',
   isa     => ArrayRef + Split,
   coerce  => 1,
);

This is one of several features designed to encourage people to combine coercions with type…

DOAPy Dist

So what's DOPE? No, not DOPE, DOAP... what's DOAP?

Here's what Wikipedia has to say...

DOAP (Description of a Project) is an RDF Schema and XML vocabulary to describe software projects, in particular free and open source software.

It was created and initially developed by Edd Dumbill to convey semantic information associated with open source software projects.

It is currently used in the Mozilla Foundation's project page and in several other software repositories, notably the Python Package Index.

Precision Testing for Modern Perl

In a previous entry I discussed some of my favourite CPAN modules for testing Perl code.

I got to thinking... there are all these little frameworks on the CPAN like GID, and Modern::Perl, and Defaults::Modern, and Bubblegum which are basically little shims to load collections of "best practices" modules in a single line. For example:

   use Modern::Perl;

is basically a shortcut for:

   use IO::File qw();
   use IO::Handle qw();
   use strict;
   use warnings;
   use feature qw( :5.12 );
   use mro qw( c3 );

So why not do the same for test suites? Why not create a module that loads Test::More, and Test::Fatal, and Test::Warnings, and so on for me?