├── .gitignore ├── .travis.yml ├── Changes ├── ReadMe.pod ├── ToDo ├── bin └── mo-inline ├── dist.ini ├── lib ├── Mo.pm ├── Mo.pod └── Mo │ ├── Design.pod │ ├── Features.pod │ ├── Golf.pm │ ├── Hacking.pod │ ├── Inline.pm │ ├── Moose.pm │ ├── Moose.pod │ ├── Mouse.pm │ ├── Mouse.pod │ ├── build.pm │ ├── build.pod │ ├── builder.pm │ ├── builder.pod │ ├── chain.pm │ ├── chain.pod │ ├── coerce.pm │ ├── coerce.pod │ ├── default.pm │ ├── default.pod │ ├── exporter.pm │ ├── exports.pod │ ├── import.pm │ ├── import.pod │ ├── importer.pm │ ├── importer.pod │ ├── is.pm │ ├── is.pod │ ├── nonlazy.pm │ ├── option.pm │ ├── option.pod │ ├── required.pm │ ├── required.pod │ ├── xs.pm │ └── xs.pod ├── src ├── Makefile ├── Mo.pm ├── Mo │ ├── Moose.pm │ ├── Mouse.pm │ ├── build.pm │ ├── builder.pm │ ├── chain.pm │ ├── coerce.pm │ ├── default.pm │ ├── exporter.pm │ ├── import.pm │ ├── importer.pm │ ├── is.pm │ ├── nonlazy.pm │ ├── option.pm │ ├── required.pm │ └── xs.pm ├── README └── update_version.pl ├── t ├── Bar.pm ├── Boo.pm ├── Foo.pm ├── Moose.t ├── Mouse.t ├── build.t ├── builder.t ├── chain.t ├── coerce.t ├── combined.t ├── default.t ├── extends.t ├── importer.t ├── is.t ├── lazy-nonlazy.t ├── main_sub.t ├── object.t ├── option.t ├── required.t ├── strict.t ├── test.t └── xs.t └── xt ├── TestClass.pm ├── TestMyMo.pm ├── inline.t ├── layout.t ├── mo-inline.t ├── module-install.t ├── module-install ├── Makefile.PL ├── README ├── lib │ └── Foo.pm └── t │ └── test.t └── release └── correct-version.t /.gitignore: -------------------------------------------------------------------------------- 1 | /Mo-*/ 2 | /Mo-*.tar.gz 3 | /.build/ 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: perl 2 | perl: 3 | - 5.18 4 | - 5.16 5 | - 5.14 6 | - 5.12 7 | - 5.10 8 | - 5.8 9 | install: true 10 | script: 11 | - touch src/Makefile && make -C src all 12 | - prove -lrs t 13 | - if perl -M5.012 -e1; then (dzil authordeps --missing | cpanm -nq || { cat ~/.cpanm/build.log ; false ; }) fi 14 | - if perl -M5.012 -e1; then (dzil listdeps --author --missing | grep -v Baz | cpanm -nq || { cat ~/.cpanm/build.log ; false ; }) fi 15 | - if perl -M5.012 -e1; then (dzil test --automated --author) fi 16 | -------------------------------------------------------------------------------- /Changes: -------------------------------------------------------------------------------- 1 | --- 2 | version: 0.40 3 | date: Wed Jul 6 23:21:21 CEST 2016 4 | changes: 5 | - Apply PR/30 and PR/31. @nfg++. @veryrusty++. 6 | --- 7 | version: 0.39 8 | date: Wed Sep 3 23:31:55 MDT 2014 9 | changes: 10 | - Apply PR/25. @daoswald++ 11 | --- 12 | version: 0.38 13 | date: Mon Oct 28 15:37:28 MYT 2013 14 | changes: 15 | - Fixed Changes file to comply to CPAN::Changes::Spec 16 | --- 17 | version: 0.37 18 | date: Fri Oct 25 21:46:59 MYT 2013 19 | changes: 20 | - 'Bugfix: Run Test::Compile tests as xt as they require optional dependencies to be present (GH issue #22)' 21 | - 'Testing: Added Travis-CI integration' 22 | - 'Makefile: Added target to update version on all packages' 23 | --- 24 | version: 0.36 25 | date: Sun Oct 20 04:44:42 MYT 2013 26 | changes: 27 | - Move the distribution to Dist::Zilla 28 | --- 29 | version: 0.35 30 | date: Mon May 27 14:23:42 PDT 2013 31 | changes: 32 | - Forgot to merge doc changes from CarlosLima++ 33 | --- 34 | version: 0.34 35 | date: Sun May 26 14:55:06 PDT 2013 36 | changes: 37 | - CarlosLima++ added nonlazy support to set defaults during construction. 38 | --- 39 | version: 0.33 40 | date: Thu Feb 28 03:31:47 MYT 2013 41 | changes: 42 | - Adds terser syntax to Mo::default 43 | - Assumes default when given odd number of arguments to has 44 | - Improved automated golfing 45 | --- 46 | version: 0.32 47 | date: Tue Feb 26 01:47:41 MYT 2013 48 | changes: 49 | - Required attributes accepts 0/undef 50 | --- 51 | version: 0.31 52 | date: Thu Apr 19 10:59:34 PDT 2012 53 | changes: 54 | - dams++ and melo++ fix https://rt.cpan.org/Public/Bug/Display.html?id=76664 and https://rt.cpan.org/Public/Bug/Display.html?id=74487 55 | --- 56 | version: 0.30 57 | date: Tue Oct 11 19:36:07 EDT 2011 58 | changes: 59 | - Don't run moose/mouse tests unless deps exist 60 | - Add Mo::importer 61 | --- 62 | version: 0.29 63 | date: Mon Oct 10 22:46:50 EDT 2011 64 | changes: 65 | - Mo::Mouse with help by gfx++ 66 | --- 67 | version: 0.28 68 | date: Sun Oct 9 16:29:07 EDT 2011 69 | changes: 70 | - First module ever released during a Lightning Talk (PPW 2011) 71 | - Mo::Moose with help by doy++ 72 | - Mo::option 73 | --- 74 | version: 0.27 75 | date: Thu Oct 6 10:33:29 EDT 2011 76 | changes: 77 | - forwardever++ added Mo::chain 78 | --- 79 | version: 0.26 80 | date: Mon Oct 3 18:03:21 BST 2011 81 | changes: 82 | - Added Mo::import and Mo::exporter. 83 | - Add Mo::xs 84 | - Make Mo::Inline better 85 | - More docs 86 | --- 87 | version: 0.25 88 | date: Sat Oct 1 15:46:19 BST 2011 89 | changes: 90 | - Add a Feature extension system. 91 | - This is a non-backward compat release as it no longer includes builder and 92 | default automatically. 93 | - Add new feaures: coerce, is. 94 | --- 95 | version: 0.24 96 | date: Sun Sep 25 12:44:29 CEST 2011 97 | changes: 98 | - Ensure that Mo.pm ends with semicolon. Needed for inlining. 99 | - Released from Laurent++ and Emmanuelle++ Parisian porch over a delightful 100 | breakfast with they and BooK. 101 | --- 102 | version: 0.23 103 | date: Wed Sep 21 23:53:13 CEST 2011 104 | changes: 105 | - Refactoring and more docs. 106 | - Released from Liz++ and Wendy++'s upstairs toilet room. (From the throne!) 107 | --- 108 | version: 0.22 109 | date: Mon Sep 12 17:18:29 CEST 2011 110 | changes: 111 | - mst++ changed default base class to Mo::O to avoid inheriting import() method 112 | --- 113 | version: 0.21 114 | date: Mon Sep 12 11:16:31 CEST 2011 115 | changes: 116 | - Add Mo::Design pod 117 | - Remove multiple inheritance 118 | - Released from Liz++ and Wendy++ kitchen 119 | --- 120 | version: 0.20 121 | date: Sun Sep 11 11:58:51 CEST 2011 122 | changes: 123 | - mv bin/compress to script/compress.pl 124 | --- 125 | version: 0.19 126 | date: Sun Sep 11 11:27:14 CEST 2011 127 | changes: 128 | - Squish! 129 | --- 130 | version: 0.18 131 | date: Sun Sep 11 09:52:30 CEST 2011 132 | changes: 133 | - Don't pollute namspace with _ (or anything) 134 | --- 135 | version: 0.17 136 | date: Sun Sep 11 03:24:17 CEST 2011 137 | changes: 138 | - Call BUILD sequence properly 139 | --- 140 | version: 0.16 141 | date: Sun Sep 11 01:31:30 CEST 2011 142 | changes: 143 | - extends can handle multiple parents 144 | --- 145 | version: 0.15 146 | date: Sat Sep 10 23:40:23 CEST 2011 147 | changes: 148 | - extends did load parent module. fixed. 149 | --- 150 | version: 0.14 151 | date: Sat Sep 10 22:25:40 CEST 2011 152 | changes: 153 | - Make default called on exists rather than undef 154 | - Add builder. Very cheap to do so. 155 | --- 156 | version: 0.13 157 | date: Fri Sep 9 19:15:05 CEST 2011 158 | changes: 159 | - dams++ adds 'default' for 'has' 160 | --- 161 | version: 0.12 162 | date: Fri Sep 9 07:52:13 CEST 2011 163 | changes: 164 | - dams++ golfing 165 | - Upgrade docs 166 | --- 167 | version: 0.11 168 | date: Thu Sep 8 15:36:35 CEST 2011 169 | changes: 170 | - Move doc from pm to pod 171 | --- 172 | version: 0.10 173 | date: Thu Sep 8 15:24:03 CEST 2011 174 | changes: 175 | - First Release 176 | -------------------------------------------------------------------------------- /ReadMe.pod: -------------------------------------------------------------------------------- 1 | lib/Mo.pod -------------------------------------------------------------------------------- /ToDo: -------------------------------------------------------------------------------- 1 | = To Do 2 | 3 | We want to put out a 0.25 release with the new Features API. 4 | 5 | + Merge Sound's new API from coerce to master 6 | - Figure out the default/builder relationship 7 | - Should default take string args like Moose and Mouse? 8 | - Decide which features we ship with core. 9 | 10 | = Features 11 | 12 | This is a list of all the known things we might do. The list will help us make 13 | better design decisions of core Mo. 14 | 15 | Please keep in mind that it is not a design goal that all of these play nicely 16 | with each other. We want that to happen more and more, but it shouldn't be a 17 | showstopper if "X does not work if declared after Y and without Z". We just 18 | add that to the doc and carry on. 19 | 20 | Please feel free to add to this list. 21 | 22 | == has Option Features 23 | 24 | - builder - calls a builder method 25 | - default - calls a code ref for the default 26 | - autobuild - adds a _build_$name method 27 | - is - provides a ro accessor 28 | - coerce - applies a function to on get 29 | - required - property is required on construction 30 | - isa - 31 | - reader - 32 | - writer - 33 | - clearer - 34 | - predicate - 35 | - lazy - 36 | - init_arg - 37 | - weak_ 38 | - trigger - 39 | - does - 40 | - handles - 41 | - traits - 42 | - description - 43 | - documentation - 44 | - auto_deref - 45 | - initializer - 46 | 47 | == Other Features 48 | 49 | - build - Call BUILD on construction 50 | - inheritance - Multiple Inheritance 51 | - roles - Adds with functionality 52 | - checks - Adds tons of compile and runtime checks 53 | - mop - Add a MOP 54 | - Moo - Uses Moo for everything 55 | - Moose - Uses Moose for everything 56 | - Mouse - Uses Moose for everything 57 | -------------------------------------------------------------------------------- /bin/mo-inline: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use Mo::Inline; 4 | exit Mo::Inline->new->run(@ARGV); 5 | -------------------------------------------------------------------------------- /dist.ini: -------------------------------------------------------------------------------- 1 | name = Mo 2 | author = Ingy döt Net 3 | license = Perl_5 4 | copyright_holder = Ingy döt Net 5 | abstract = Micro Objects. Mo is less. 6 | main_module = lib/Mo.pm 7 | version = 0.40 8 | 9 | ;Mo-specific 10 | [Run::BeforeBuild] 11 | run = touch src/**/* ; ensure we always re-process all the files 12 | run = make -C src/ version all ; re-sync version declarations before re-minifying 13 | ; any uncommited change will be picked by Git::Check 14 | [Git::Check] 15 | 16 | ;Disabled auto version bump for the 0.40 release. Consider turning back on. 17 | ;[@INGY] 18 | [@Filter] 19 | -bundle = @INGY 20 | -remove = Git::NextVersion 21 | -remove = ReportVersions::Tiny 22 | [Test::ReportPrereqs] 23 | 24 | 25 | Git::GatherDir.exclude_match[0] = ^src/ 26 | Git::GatherDir.exclude_match[1] = ToDo 27 | ;Git::GatherDir.exclude_match[2] = ^xt/ 28 | ; authordep Dist::Zilla::Plugin::Test::Compile = 2.037 29 | Test::Compile.fake_home = 1 30 | Test::Compile.xt_mode = 1 31 | # NextRelease.format = ---%nversion: %{-TRIAL}V%ndate: %{ccc MMM dd HH:mm:ss zzz YYYY}d%nchanges: 32 | ReadmeFromPod.filename = lib/Mo.pod 33 | AutoPrereqs.skip = .* ; Should I filter AutoPrereqs from the bundle instead? 34 | 35 | [ChangesFromYaml] 36 | dateformat = ccc MMM dd HH:mm:ss zzz yyyy 37 | 38 | [GithubMeta] 39 | user = ingydotnet 40 | issues = 1 41 | 42 | [MetaNoIndex] 43 | directory = t 44 | directory = xt 45 | directory = inc 46 | directory = src 47 | package = DB ; just in case 48 | 49 | [ExtraTests] 50 | [RunExtraTests] 51 | [Test::NoTabs] 52 | [Test::EOL] 53 | [Test::Version] 54 | [MetaTests] 55 | [CheckMetaResources] 56 | ; needs fixing: [Test::ChangesHasContent] 57 | 58 | 59 | [Prereqs] 60 | perl = 5.6.0 61 | 62 | [Prereqs / Recommends] 63 | Class::XSAccessor = 0 64 | IO::All = 0 65 | Moose = 0 66 | Mouse = 0 67 | 68 | [Test::PodSpelling] 69 | stopwords = Alessandro 70 | stopwords = Embeddable 71 | stopwords = Krotkine 72 | stopwords = Ranellucci 73 | stopwords = Walde 74 | stopwords = priodev 75 | stopwords = PPI 76 | stopwords = al 77 | stopwords = embeddable 78 | stopwords = et 79 | stopwords = inlines 80 | stopwords = irc 81 | stopwords = optimizations 82 | stopwords = rw 83 | stopwords = stevan 84 | stopwords = suboptimal 85 | stopwords = ungolfed 86 | stopwords = versa 87 | stopwords = Finalizer 88 | stopwords = getter 89 | stopwords = ro 90 | stopwords = instantiation 91 | stopwords = chainable 92 | stopwords = API 93 | stopwords = CPAN 94 | stopwords = döt 95 | stopwords = GitHub 96 | stopwords = mst 97 | stopwords = OO 98 | stopwords = runtime 99 | stopwords = startup 100 | -------------------------------------------------------------------------------- /lib/Mo.pm: -------------------------------------------------------------------------------- 1 | package Mo; 2 | $VERSION='0.40'; 3 | no warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{my$c=shift;my$s=bless{@_},$c;my%n=%{$c.'::'.':E'};map{$s->{$_}=$n{$_}->()if!exists$s->{$_}}keys%n;$s};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};@_=(default,@_)if!($#_%2);$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object}; 4 | -------------------------------------------------------------------------------- /lib/Mo.pod: -------------------------------------------------------------------------------- 1 | =encoding utf8 2 | 3 | =head1 Name 4 | 5 | Mo - Micro Objects. Mo is less. 6 | 7 | =head1 Synopsis 8 | 9 | package Less; 10 | use Mo; 11 | extends 'Nothing'; 12 | 13 | has something => (); 14 | 15 | =head1 Description 16 | 17 | use Mo. Mo is less. Much less. 18 | 19 | Moose is huge. Moose led to Mouse led to Moo led to Mo. M is nothing. Mo is 20 | more. Not much. 21 | 22 | When Moo is more than you need, drop an 'o' and get some Mo. 23 | 24 | To get just a little Mo from Mo, use L below. 25 | 26 | =head1 Core Features 27 | 28 | This is what you get. Nothing Mo. 29 | 30 | =over 31 | 32 | =item C method 33 | 34 | Mo provides a C object constructor. You pass it a list of name/value 35 | pairs and it returns a new object. 36 | 37 | Constructor will not call BUILD methods. This is available using the 38 | L feature. 39 | 40 | =item C 41 | 42 | Mo exports the C keyword, to declare your parent class. C 43 | itself is your default parent class. 44 | 45 | Mo only supports single inheritance. If you need multiple inheritance or 46 | roles, you should upgrade to Moo. 47 | 48 | =item C 49 | 50 | Mo exports a C keyword, to generate accessors. 51 | 52 | These accessors always support both C and C operations. That's it. 53 | 54 | has name => (); 55 | has thing => (foo => 'bar'); # arguments silently ignored 56 | 57 | All arguments passed to C are ignored. This makes it easier to switch 58 | between Mo and Moo, without having to change all your accessors. 59 | 60 | =item C and C 61 | 62 | Mo turns on C and C for you. 63 | 64 | =item Embeddable 65 | 66 | Mo is tiny. It is compressed into a single line. You can easily inline it in 67 | your code, should you want to do that. See L for more information, 68 | including a utility that will do it for you. 69 | 70 | =back 71 | 72 | =head1 Mo Features 73 | 74 | Mo is the bare minimum needed for Perl OO. Many times you'll want just a 75 | couple more features. Don't worry. Mo's got you covered: 76 | 77 | use Mo qw'build default builder coerce is required'; 78 | has name1 => ( default => sub { 'Joe' } ); 79 | has name2 => ( builder => 'name_builder' ); 80 | has name3 => ( coerce => sub {$_[0]} ); 81 | has name4 => ( is => 'ro' ); 82 | has name4 => ( required => 1 ); 83 | sub BUILD { 84 | my $self = shift; 85 | ... 86 | } 87 | 88 | Mo simply loads the feature classes L, L, 89 | L, L, L and L. 90 | The first one supports BUILD constructing and the other three 91 | add their magics to C. A L module can enhance C, 92 | C and C, and also add new export subs, or remove existing ones. 93 | Features can also be combined for a single accessor. 94 | See L for a list of all the features and for an explanation of 95 | the Feature API.. 96 | 97 | =head1 See 98 | 99 | L 100 | 101 | L 102 | 103 | L 104 | 105 | L 106 | 107 | =head1 Status 108 | 109 | =begin html 110 | 111 |

Build Status

112 | 113 | =end html 114 | 115 | =head1 Authors 116 | 117 | Ingy döt Net 118 | 119 | Damien 'dams' Krotkine 120 | 121 | Matt S. Trout (mst) 122 | 123 | Christian Walde 124 | 125 | Alessandro Ranellucci (aar/alexrj) 126 | 127 | Carlos Lima (priodev) 128 | 129 | =head1 Copyright and License 130 | 131 | Copyright (c) 2011-2016. Ingy döt Net. 132 | 133 | This program is free software; you can redistribute it and/or modify it 134 | under the same terms as Perl itself. 135 | 136 | See http://www.perl.com/perl/misc/Artistic.html 137 | 138 | =cut 139 | -------------------------------------------------------------------------------- /lib/Mo/Design.pod: -------------------------------------------------------------------------------- 1 | =head1 Overview 2 | 3 | This is the design document for the L module. 4 | 5 | It is intended to help people understand the thinking behind Mo. 6 | 7 | Like Mo, this document is a work in progress. Nothing here is in stone. 8 | Everything is up for discussion. This document just explains the current 9 | understanding, so you'll know where to start. 10 | 11 | =head1 Design Goals 12 | 13 | Mo has the following design goals. These goals are all important and have to 14 | be balanced against each other. 15 | 16 | =over 17 | 18 | =item Provide usable OO for Perl modules. 19 | 20 | This includes I the following. The current implementation contains a 21 | bit more than this, but that is due to the other design goals. 22 | 23 | =over 24 | 25 | =item Single Inheritance 26 | 27 | Mo should provide a mechanism for inheritance. At least single inheritance. 28 | 29 | =item Object Construction 30 | 31 | Mo needs to provide a C object constructor. It should take a set of 32 | name/value pairs and return a new object reference, blessed into the class' 33 | package name. 34 | 35 | =item Attribute Declaration 36 | 37 | Mo needs to provide a way to declare attribute accessing methods. They need to 38 | be able to set and get values. 39 | 40 | =back 41 | 42 | =item Be minimal 43 | 44 | Mo only adds core features if they are considered very desirable B can be 45 | implemented in a very small amount of code. Most features are in external 46 | C modules now. 47 | 48 | =item Be useful 49 | 50 | Mo wants to be the first module that Perl programmers reach for when they need 51 | simple OO. To that end, it needs to be extremely useful and support common 52 | idioms, even if they are not strictly minimal. 53 | 54 | =item Be fast 55 | 56 | Mo should be about as fast as if you rolled your own OO. It should be fast at 57 | both startup (compile) time and at run time. It should especially strive to 58 | have fast accessors. Speed optimizations should be simple and minimal. 59 | 60 | =item Be embeddable 61 | 62 | There may be situations where you want to inline Mo into your code. For this 63 | reason, Mo will try to be in one minimal pure Perl file, with no comments or 64 | documentation. See C. 65 | 66 | =item Easy upgrade/downgrade path with Moo 67 | 68 | L has become the accepted style of OO in perl. Mo will attempt to not 69 | do the things it does in an incompatible style to the C family. 70 | 71 | This is not to say that all Mo code can be switched to Moo, or vice versa. 72 | This I to say that you should be able to find a style of coding using the 73 | full capabilities of Mo, that you can switch to L (or L or L), 74 | if you want to. 75 | 76 | This is a difficult design goal, and might sometimes lose out to the other 77 | goals. However, this document will attempt to explain all the decisions. 78 | 79 | =back 80 | 81 | =head1 Current Status 82 | 83 | This section will go into detail on all the current aspects of Mo, why 84 | decisions were made and any known concerns being thought about. 85 | 86 | =over 87 | 88 | =item Inheritance 89 | 90 | Mo uses C to name its (single inheritance) parent. 91 | 92 | In the past, Mo supported multiple inheritance. This was considered suboptimal 93 | for a few reasons. MI is generally frowned upon in Perl. It has problems 94 | that are better solved by roles. It also makes the BUILD call sequence much 95 | more difficult, which makes Moose compatibility hard. For these reasons, we 96 | removed MI as a Mo feature. As a result, the code became much simpler. 97 | 98 | It is highly doubtful that roles will be supported either. One should upgrade 99 | to Moo or higher when MI or roles become needed. 100 | 101 | =item Construction 102 | 103 | Mo uses a C method for construction. It is super minimal and fast. It does no calling of the BUILD sequence. To get that, use: 104 | 105 | use Mo 'build'; 106 | 107 | =item Accessors 108 | 109 | Mo uses C for generating accessors. Like Moose, it takes a name and a 110 | list of option/value pairs. 111 | 112 | All options are silently ignored. Options like C and C are 113 | available as feature modules: 114 | 115 | use Mo qw'default builder'; 116 | 117 | The default getter/setter is optimized for speed. It does no checks and is 118 | always 'rw'. 119 | 120 | =item No runtime checks 121 | 122 | Mo will not check or validate its usage. It is so minimal, that it will leave 123 | this up to the code author. Run time checks don't offer any gain when the 124 | usage is already correct. In a dynamic language like Perl, they only serve to 125 | make code slower. Plus, runtime checks would bloat the Mo code. Where would 126 | you draw the line? The best option is to leave them out, document things well, 127 | and let people write tests for their code, if they really need to. Upgrading 128 | from Mo is another alternative. 129 | 130 | =item Size matters 131 | 132 | Mo.pm and its feature modules are golfed, compressed and unreadable by mere 133 | mortals. It has no comments or pod. The documentation is in Mo.pod and the 134 | comments are all in here. This makes Mo.pm a little black box of code that you 135 | can use anywhere. 136 | 137 | When we hack on Mo.pm we do it on src/. When we are done we run C and it compresses stuff into C. 139 | 140 | The package declaration and $VERSION are on their own lines. That way if 141 | someone inlines Mo, they can make their own package line more easily, and just 142 | grab line 3, the code. 143 | 144 | =item strict and warnings 145 | 146 | We turn on strict and warnings for the user of Mo because it is really easy 147 | and offers great value. Also, all the other Moose family does it. 148 | 149 | =back 150 | 151 | =head1 Topics, Concerns and Issues 152 | 153 | This is a list of everything else. 154 | 155 | =head2 The feature system 156 | 157 | Mo now has a decent feature system so that almost anything can be added piecemeal. To use features you say: 158 | 159 | use Mo qw'foo bar'; 160 | 161 | This loads Mo::foo and Mo::bar. It calls the C subroutine on each. 162 | 163 | =head2 1024 Size Limit 164 | 165 | Mo.pm has a goal to never be larger than 1024 bytes. It has almost never been 166 | larger than 500 bytes so far. It is currently under 450 and should only go 167 | down (assuming we have the core features nailed down). 168 | 169 | =head2 Automated Golfing 170 | 171 | I want to start a policy that all of the golfing efforts will be made via a 172 | script to sane code. We should automate testing both the ungolfed and golfed 173 | code. 174 | 175 | Golfing has now been automated using the power of PPI. 176 | 177 | =head2 Moose and Moo creators like Mo 178 | 179 | I can't (and am certain that I don't) speak for all the Moose community, But 180 | I(ngy) personally know that stevan (creator of Moose) and mst (creator of Moo) 181 | approve of Mo. They hang out on the #mo irc channel, and mst has made a large 182 | portion of the code commits. 183 | 184 | This is a sign of a healthy project, because hopefully we can all forge a 185 | clear idea of how all these modules relate to each other and support each 186 | other. 187 | 188 | =head2 Why not Moose? 189 | 190 | The sad fact of Perl 5 is that there's no object model built in. 191 | 192 | Moose not only added an elegant, usable object model, it took OO to a new 193 | level. It is indeed a postmodern system. Unfortunately this comes at a (often 194 | hefty) performance price. 195 | 196 | Attempts to make something similar but less hefty came in the forms of 197 | L, L and L. L is just the next attempt. It is a bare 198 | minimum OO framework, that still looks like Moose. 199 | 200 | I've heard people argue that Mo doesn't belong in the Moose family, but those 201 | same people often feel the same way about Mouse and Moo. It won't stop me from 202 | trying to make something wonderful, that can be fairly easily upgraded to 203 | something possibly more wonderful. 204 | 205 | With each of these attempts, less of the original Moose power is implemented. 206 | This annoys the hardcore Moose developers. But hopefully it pushes them 207 | towards making Moose better and better. I can imagine the day when Moose is a 208 | compiled in part of the C interpreter and thus faster then Mo. At that 209 | point, all the others will become remnants of the past. 210 | 211 | In the meantime, I hope that Mo et al, helps people to get past their Moose 212 | inhibitions, and start using the Mo* that makes sense. I(ngy) have authored 213 | other OO base modules like L and L. There are things about those that 214 | I sorely miss in the Moose family, but I have decided to stopping fighting the 215 | Moose. I for one, welcome our new giant antlered overlord. 216 | 217 | -------------------------------------------------------------------------------- /lib/Mo/Features.pod: -------------------------------------------------------------------------------- 1 | =head1 Mo Features 2 | 3 | Mo is absolutely minimal, but it let's you easily add many features like this: 4 | 5 | use Mo qw[default builder other features]; 6 | 7 | This will load the modules L, etc, and have them modify your Mo 8 | reality. 9 | 10 | Here's a list of the current feature modules that ship with L: 11 | 12 | =over 13 | 14 | =item L 15 | 16 | Add C feature to C. 17 | 18 | =item L 19 | 20 | Add C feature to C. 21 | 22 | =item L 23 | 24 | Add C feature to C. 25 | 26 | =item L 27 | 28 | Add C feature to C. 29 | 30 | =item L 31 | 32 | Exporter for L usage. Only works with inlined Mo. 33 | 34 | =item L 35 | 36 | Finalizer for L usage. Only works with inlined Mo. 37 | 38 | =item L 39 | 40 | Add C feature to C. 41 | 42 | =item L 43 | 44 | Use Moose in place of Mo for everything. 45 | 46 | =item L 47 | 48 | Use Mouse in place of Mo for everything. 49 | 50 | =item L 51 | 52 | Add C