Find file
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (46 sloc) 1.7 KB
Mo - Micro Objects. Mo is less.
package Less;
use Mo;
extends 'Nothing';
has 'something' => ( is => 'rw' );
sub BUILD {
my $self = shift;
# ...
use Mo. Mo is less.
Moose led to Mouse led to Moo led to Mo. M is nothing. Mo is more. Not
When Moo is more than you need, drop an 'o' and get some Mo.
This is what you get. Nothing Mo.
"new" method
Mo provides a "new" object constructor. It will call the "BUILD"
method after creation if it "can".
Mo exports the "extends" keyword, to name your parent class. "Mo"
itself is your default parent class, of course.
Mo exports a "has" keyword, to generate accessors.
These accessors support "get" and "set" operations. That's it.
Any extra arguments after the name, are silently ignored.
has 'name';
has 'same' => ( is => 'ro' );
This lets you switch from Moo to Mo and back, without having to
change all your accessors.. The attribute is lazy, meaning
it gets created only when needed.
"strict" and "warnings"
Mo turns on "use strict" and "use warnings".
Mo is tiny. You can easily inline it in your code, if you want to.
Ingy döt Net <>
Damien 'dams' Krotkine <>
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.