Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Perl Micro Objects

This branch is 173 commits behind ingydotnet:master


    Mo - Micro Objects. Mo is less.

        package Less;
        use Mo;
        extends 'Nothing';

        has something => ();

        sub BUILD {
            my $self = shift;
            # enhance your object before it is returned by new()

    use Mo. Mo is less. Much less.

    Moose is huge. Moose led to Mouse led to Moo led to Mo. M is nothing. Mo
    is more. Not much.

    When Moo is more than you need, drop an 'o' and get some Mo.

    To get just a little Mo from Mo, use "Mo Features" below.

Core Features
    This is what you get. Nothing Mo.

    "new" method
        Mo provides a "new" object constructor. You pass it a list of
        name/value pairs and it returns a new object.

        After object creation, it will call the "BUILD" method (if present)
        for all of its parents and itself.

        Mo exports the "extends" keyword, to declare your parent class.
        "Mo::Object" itself is your default parent class.

        Mo only supports single inheritance. If you need multiple
        inheritance or roles, you should upgrade to Moo.

        Mo exports a "has" keyword, to generate accessors.

        These accessors always support both "get" and "set" operations.
        That's it.

            has name => ();
            has thing => (is => 'ro');  # arguments silently ignored

        All arguments passed to "has" are ignored. This makes it easier to
        switch between Mo and Moo, without having to change all your

    "strict" and "warnings"
        Mo turns on "use strict" and "use warnings" for you.

        Mo is tiny. It is compressed into a single line. You can easily
        inline it in your code, should you want to do that. See Mo::Inlining
        for more information.

Mo Features
    Mo is the bare minimum needed for Perl OO. Many times you'll want just a
    couple more features. Don't worry. Mo's got you covered:

        use Mo qw'default builder';
        has name1 => ( default => sub { 'Joe' } );
        has name2 => ( builder => 'name_builder' );

    Mo simply loads the feature classes Mo::default and Mo::builder. These
    add their magics to "has". A Mo::Feature module can enhance "new",
    "extends" and "has", and also add new export subs, or remove existing
    ones. See Mo::Features for a list of all the features and for an
    explanation of the Feature API..





    Ingy döt Net <>

    Damien 'dams' Krotkine <>

    Matt S. Trout (mst) <>

    Christian Walde <>

Copyright and License
    Copyright (c) 2011. Ingy döt Net.

    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.


Something went wrong with that request. Please try again.