- WHENCE MOUSSE?
- MOUSSE FEATURES AND ADVANTAGES
Mousse - A Light and Tasty Moose for CPAN Authors
use inc::Module::Install; name 'Chocolate'; use_mousse 'Chocolate::Mousse';
package Chocolate::Jesus; use Chocolate::Mousse; has 'soul', is => 'ro';
package Chocolate::Jeebus; use Chocolate::Mousse; extends 'Chocolate::Jesus'; has 'whiskers', is => 'rw';
Mousse adds NO prerequisite dependencies to your CPAN module.
Mousse is enabled by adding one line to your Makefile.PL.
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.
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 version of Mousse have installed, every time you run
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:
then Mousse::Maker will whip up a
lib/Foo/Widget/OO.pm file for you from the Mousse.pm installed on your system.
Alternatively, if you use this line in your Makefile.PL:
then Mousse::Maker will create a
lib/Foo/Widget/OO.pm file for you from the Mouse parts installed on your system.
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.
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
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.
Scalar::Random::PP is an example of a CPAN module that uses Mousse.
If you have a module to add here, let me know.
Thanks to Stevan Little for the movement that is Moose.
The guts of this module is pure, un(well slightly)adulterated Mouse. 藤吾郎++
Also, many thanks to Luke Closs' cat, Jeebus!
Ingy döt Net <email@example.com>
Copyright (c) 2010, 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.