[cgiapp] which Moose-compatible variant to use?

Mark Stosberg mark at summersault.com
Thu Nov 8 10:38:02 EST 2012


> A win for the MOP it seems :)...and a nice feeling idiom to boot.

Speaking of Moose, here's a bit of discussion on Any::Moose vs alternatives.

I had heard people talk in general terms how Any::Moose might be
problematic, but not a lot of specific examples.

Here's rjbs providing one, involving "Throwable":
http://rjbs.manxome.org/rubric/entry/1916

I ran into another one at work yesterday, hitting what I call the
"Any::Moose tipping point".

The Moose tipping point is the point at when your project grows to gain
Moose as a dependency somewhere in the chain. Once you've passed that
tipping point and paid for loading it, you might as well use it in more
places.

The Any::Moose tipping point is when you are rolling along in your
project using Any::Moose, and you run into a must-have dependency which
is Moose-specific and has no Mouse equivalent. (for me, I started using
MooseX::Singleton to make sure our configuration file was only loaded
and parsed once). We use our "config role" nearly everywhere, so we
might as well refactor places that had "use Any::Moose" to just "use
Moose" directly.

The big reason for us to bother with Any::Moose was to make our unit
tests run faster. (I got the test suite down from 25 minutes to 4.5
minutes using various techniques, but taking a second or two extra for
each of hundreds of test files still matters for us).

However, just in the past few days, "forkprove" has been developed and
pushed to CPAN, and it addresses just this case. It allows prove to
pre-load Moose, and then fork a new process with a copy for each test
file run. This is the same pre-loading strategy used by Apache/mod_perl.

At this point, I'm not interested in using Moose in the new project
because of it's slower load time under... I want to use one of the
lighter alternatives.

Some have recommended or starting using Moo as an alternative to Mouse
or Any::Moose, but I wasn't pleased with how slow the accessors
benchmarks turned out for it compared to some alternatives:

https://gist.github.com/3431863

We've discussed it some before, but I'll re-open the discussion about
which Moose-compatible variant to use in the new project.

   Mark








More information about the cgiapp mailing list