Extending Moose for Applications

Extending Moose for Applications

Using Moose provides many immediate and obvious benefits, starting with the obviation of typing "use strict" and "use warnings" in your classes.

The real power of Moose, however, rests in its extensibility. By subclassing Moose's metaclasses, you can augment and change Moose's behavior to suit your application's needs. This extensibility is powered by the meta-object protocol of Moose's foundation, Class::MOP.

The motivating example for extending Moose will be the creation of a small web framework to empower a Twitter-alike. The focus will be creating meta-level roles so that metaclasses may select exactly which changes in behavior they wish to exhibit. Modules that will be used include Moose::Exporter (to define sugary keywords) and Moose::Util::MetaRole (to extend classes composably).

Experience with using Moose to create regular classes is expected. Having some familiarity with roles will let you get more out of the talk. No experience with metaprogramming is required.


Shawn Moore

October 23, 2011