1Mo(3)                 User Contributed Perl Documentation                Mo(3)
2
3
4

Name

6       Mo - Micro Objects. Mo is less.
7

Synopsis

9           package Less;
10           use Mo;
11           extends 'Nothing';
12
13           has something => ();
14

Description

16       use Mo. Mo is less. Much less.
17
18       Moose is huge. Moose led to Mouse led to Moo led to Mo. M is nothing.
19       Mo is more. Not much.
20
21       When Moo is more than you need, drop an 'o' and get some Mo.
22
23       To get just a little Mo from Mo, use "Mo Features" below.
24

Core Features

26       This is what you get. Nothing Mo.
27
28       "new" method
29           Mo provides a "new" object constructor. You pass it a list of
30           name/value pairs and it returns a new object.
31
32           Constructor will not call BUILD methods. This is available using
33           the Mo::build feature.
34
35       "extends"
36           Mo exports the "extends" keyword, to declare your parent class.
37           "Mo::Object" itself is your default parent class.
38
39           Mo only supports single inheritance. If you need multiple
40           inheritance or roles, you should upgrade to Moo.
41
42       "has"
43           Mo exports a "has" keyword, to generate accessors.
44
45           These accessors always support both "get" and "set" operations.
46           That's it.
47
48               has name => ();
49               has thing => (foo => 'bar');  # arguments silently ignored
50
51           All arguments passed to "has" are ignored. This makes it easier to
52           switch between Mo and Moo, without having to change all your
53           accessors.
54
55       "strict" and "warnings"
56           Mo turns on "use strict" and "use warnings" for you.
57
58       Embeddable
59           Mo is tiny. It is compressed into a single line. You can easily
60           inline it in your code, should you want to do that. See Mo::Inline
61           for more information, including a utility that will do it for you.
62

Mo Features

64       Mo is the bare minimum needed for Perl OO. Many times you'll want just
65       a couple more features. Don't worry. Mo's got you covered:
66
67           use Mo qw'build default builder coerce is required';
68           has name1 => ( default => sub { 'Joe' } );
69           has name2 => ( builder => 'name_builder' );
70           has name3 => ( coerce => sub {$_[0]} );
71           has name4 => ( is => 'ro' );
72           has name4 => ( required => 1 );
73           sub BUILD {
74               my $self = shift;
75               ...
76           }
77
78       Mo simply loads the feature classes Mo::build, Mo::default,
79       Mo::builder, Mo::coerce, Mo::is and Mo::required.  The first one
80       supports BUILD constructing and the other three add their magics to
81       "has". A Mo::Feature module can enhance "new", "extends" and "has", and
82       also add new export subs, or remove existing ones.  Features can also
83       be combined for a single accessor.  See Mo::Features for a list of all
84       the features and for an explanation of the Feature API..
85

See

87       Mo::Features
88
89       Mo::Inlining
90
91       Mo::Hacking
92
93       Mo::Design
94

Status

Authors

97       Ingy döt Net <ingy@cpan.org>
98
99       Damien 'dams' Krotkine <dams@cpan.org>
100
101       Matt S. Trout (mst) <mst@shadowcat.co.uk>
102
103       Christian Walde <walde.christian@googlemail.com>
104
105       Alessandro Ranellucci (aar/alexrj) <aar@cpan.org>
106
107       Carlos Lima (priodev) <carlos@cpan.org>
108
110       Copyright (c) 2011-2013. Ingy döt Net.
111
112       This program is free software; you can redistribute it and/or modify it
113       under the same terms as Perl itself.
114
115       See http://www.perl.com/perl/misc/Artistic.html
116
117
118
119perl v5.28.0                      2016-07-06                             Mo(3)
Impressum