NAME
Mousse - A Light and Tasty Moose for CPAN Authors
STATUS
This is a very early release of Mousse for developers to play with and
comment on. Even though the design of Mousse is very straightforward,
please wait a release or two for anything beyond a taste test.
SYNOPSIS
In your "Makefile.PL":
use inc::Module::Install;
name 'Chocolate';
use_mousse 'Chocolate::Mousse';
then in "lib/Chocolate/Jesus.pm":
package Chocolate::Jesus
use Chocolate::Mousse;
has 'forgiveness', is => 'ro';
and:
package Chocolate::Jeebus;
use Chocolate::Mousse;
extends 'Chocolate::Jesus';
has 'whiskers', is => 'rw';
DESCRIPTION
Mousse is the easiest way to get Moose support for your OO CPAN module.
Mousse adds NO prerequisite dependencies to your CPAN module.
Mousse has the same performance qualities as the zippy Mouse.
Mousse is enabled by adding one line to your Makefile.PL.
WHENCE MOUSSE?
If you are a CPAN module author, you need to weigh the benefit of using
Moose against the startup performance hit and sizable module
prerequisite dependency. Should your simple module even use OO? Should
you force a Moose dependency on every other module or project that uses
your module? Should roll your own OO code and pass up the robustness of
Moose? These questions grate on the concious of many CPAN authors.
No longer!
You've probably heard of Mouse. Mouse is a way to do all the core Moose
functionality but without the performance costs. Mouse::Tiny puts all
the Mouse modules into one module, but you still have a dependency on
Mouse::Tiny. One solution is to copy Mouse::Tiny as your own module's OO
base. But then you have to repeat that every time a new Mouse version is
released.
Another solution is to use Mousse! Mousse will remake your OO base
module from the current Mouse version you have installed, every time you
run "perl Makefile.PL".
MOUSSE FEATURES AND ADVANTAGES
Mousse IS Mouse
To learn about the features of Mousse (i.e. your generated Mousse-based
OO module), simply read Mouse.
Mousse is an exact copy of Mouse::*. It uses the same build process as
Mouse::Tiny does, except that it names the resulting module whatever you
want to call it. For example, if you use this line in your Makefile.PL:
use_mousse 'Foo::Widget::OO';
then Mousse::Maker will craft a "lib/Foo/Widget/OO.pm" file for you from
the Mouse parts installed on your system.
Mousse adds a touch of Gloom
Gloom is a much lighter weight OO module. It offers the bare minimum
essentials of OO. Gloom installs using the same Makefile.PL based
methodology as Mousse.
For the most part Gloom has lessfeatures to offer than Moose, but it
does have one nice API difference. Take a look at the code in the
synopsis. It could also be written like this:
package Chocolate::Jesus
use Chocolate::Mousse -base;
has 'forgiveness', is => 'ro';
and:
package Chocolate::Jeebus;
use Chocolate::Jesus -base;
has 'whiskers', is => 'rw';
By using the "-base" syntax, you don't need to use the "extends"
command. Every subclass of Mousse has all the OO injecting properties of
Mousse itself. In Gloom parlance, it is cascading.
Mousse allows this Gloom-style usage.
No Dependency Hell Issues
When you distribute a module that uses Mousse for OO, you can be assured
that you have coded and tested against the exact copy of Mousse that
your users will be running with. When a Mousse related bug is found, you
can simply ship a new copy of your code (with the repaired copy of
Mousse) and be certain that nobody will be trampled by a wild Moose.
Using Mousse without Module::Install
If you don't use Module::Install for your Makefile.PL, or if you want to
only update Mousse by hand, you can use this simple command:
perl -MMousse::Maker -e make_mousse 'Chocolate::Mousse' > lib/Chocolate/Mousse.pm
You Can Use Mousse as a Prerequisite
If you don't care about adding a dependency and you don't want to ship
your own copy of Mousse, you can use it just like Mouse::Tiny.
RESOURCES
The Mousse module can be found on CPAN and on GitHub:
.
Please join #moose-dev on irc.perl.org to discuss Mousse.
AUTHOR
Ingy döt Net
COPYRIGHT
Copyright (c) 2010. Ingy döt Net.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html