Telephone +44(0)1524 64544
Email: info@shadowcat.co.uk

Moo 1.0!

Wed Jul 18 21:50:00 2012

Moo 1.0!

Well, that took a while.

First released in November 2010, Moo has been an increasingly popular alternative to Moose for projects where the full power of Moose simply isn't required.

The feature set is the result of my spending over a year writing all of the classes in my personal projects from scratch, in order to work out what parts of Moose I really badly missed. This was not an exercise I would recommend, although I believe the landlady of my favourite pub enjoyed the extra revenue.

So what do we get?

Moo provides the standard Moose class setup keywords:

extends 'SuperClass';

with 'RoleName';

has attr_name => (...);

before/after/around method_name => sub { ... };

Its implementation of has is mostly complete, albeit we don't provide a type system in core at all - see MooX::Types::MooseLike for a MooseX::Types like solution there.

The with keyword can consume Moo, Moose or Mouse roles.

I've ignored override and augment because they're overly clever features that in my experience are better implemented by an around modifier or adding an extra method respectively, and there are a few more bits and pieces - there's a full list in the docs.

Now Moosify!

Possibly the most important feature of Moo is metaclass inflation. When Moo is initially loaded, it installs a hook object that will be destroyed if Moose is loaded. If this happens, Moo::HandleMoose is loaded.

Moo::HandleMoose installs fake metaclass objects for all Moo classes and roles - and if those are ever used for anything, automatically upgrades them to a full Moose::Meta::Class or Moose::Meta::Role - so Moose code can consume Moo code without ever noticing that it isn't antlers all the way down.

Why now?

Moo has been in production since a few months after its first release, is the chosen OO system for Dancer 2, and the metaclass inflation code is solid enough that we're still finding the occasional new edge case but I fully believe that the API is something we can maintain compatibility for, and that the architecture is going to carry us forwards for at least a year or two to come.

Enjoy!

-- mst, out.