README
1Name
2
3 Mo - Micro Objects. Mo is less.
4
5Synopsis
6
7 package Less;
8 use Mo;
9 extends 'Nothing';
10
11 has something => ();
12
13Description
14
15 use Mo. Mo is less. Much less.
16
17 Moose is huge. Moose led to Mouse led to Moo led to Mo. M is nothing.
18 Mo is more. Not much.
19
20 When Moo is more than you need, drop an 'o' and get some Mo.
21
22 To get just a little Mo from Mo, use "Mo Features" below.
23
24Core Features
25
26 This is what you get. Nothing Mo.
27
28 new method
29
30 Mo provides a new object constructor. You pass it a list of
31 name/value pairs and it returns a new object.
32
33 Constructor will not call BUILD methods. This is available using the
34 Mo::build feature.
35
36 extends
37
38 Mo exports the extends keyword, to declare your parent class.
39 Mo::Object itself is your default parent class.
40
41 Mo only supports single inheritance. If you need multiple inheritance
42 or roles, you should upgrade to Moo.
43
44 has
45
46 Mo exports a has keyword, to generate accessors.
47
48 These accessors always support both get and set operations. That's
49 it.
50
51 has name => ();
52 has thing => (foo => 'bar'); # arguments silently ignored
53
54 All arguments passed to has are ignored. This makes it easier to
55 switch between Mo and Moo, without having to change all your
56 accessors.
57
58 strict and warnings
59
60 Mo turns on use strict and use warnings for you.
61
62 Embeddable
63
64 Mo is tiny. It is compressed into a single line. You can easily
65 inline it in your code, should you want to do that. See Mo::Inline
66 for more information, including a utility that will do it for you.
67
68Mo Features
69
70 Mo is the bare minimum needed for Perl OO. Many times you'll want just
71 a couple more features. Don't worry. Mo's got you covered:
72
73 use Mo qw'build default builder coerce is required';
74 has name1 => ( default => sub { 'Joe' } );
75 has name2 => ( builder => 'name_builder' );
76 has name3 => ( coerce => sub {$_[0]} );
77 has name4 => ( is => 'ro' );
78 has name4 => ( required => 1 );
79 sub BUILD {
80 my $self = shift;
81 ...
82 }
83
84 Mo simply loads the feature classes Mo::build, Mo::default,
85 Mo::builder, Mo::coerce, Mo::is and Mo::required. The first one
86 supports BUILD constructing and the other three add their magics to
87 has. A Mo::Feature module can enhance new, extends and has, and also
88 add new export subs, or remove existing ones. Features can also be
89 combined for a single accessor. See Mo::Features for a list of all the
90 features and for an explanation of the Feature API..
91
92See
93
94 Mo::Features
95
96 Mo::Inlining
97
98 Mo::Hacking
99
100 Mo::Design
101
102Status
103
104Authors
105
106 Ingy döt Net <ingy@cpan.org>
107
108 Damien 'dams' Krotkine <dams@cpan.org>
109
110 Matt S. Trout (mst) <mst@shadowcat.co.uk>
111
112 Christian Walde <walde.christian@googlemail.com>
113
114 Alessandro Ranellucci (aar/alexrj) <aar@cpan.org>
115
116 Carlos Lima (priodev) <carlos@cpan.org>
117
118Copyright and License
119
120 Copyright (c) 2011-2013. Ingy döt Net.
121
122 This program is free software; you can redistribute it and/or modify it
123 under the same terms as Perl itself.
124
125 See http://www.perl.com/perl/misc/Artistic.html
126
127