Is this a good alternative to Moose Perl?

471 views Asked by At

I have been a searching for alternative to Moose (Modern object-oriented Perl) Because Moose is slow I have seen several post relation to this issue, I not want that. Example from the same creator: https://www.youtube.com/watch?v=ugEry1UWg84&feature=youtu.be&t=260

So I found this alternative from the same creator of moose:

https://metacpan.org/pod/MOP#DESCRIPTION MOP - A Meta Object Protocol for Perl 5

This module implements a Meta Object Protocol for Perl 5 with minimal overhead and no non-core dependencies (eventually).

Work with UNIVERSAL::Object:

https://metacpan.org/pod/UNIVERSAL::Object

Is this a good choice and alternative to Moose, does someone test this software ?

Related post: https://www.perlmonks.org/?node_id=1220917

Thanks.

Note: I forget to mention I know about Moo, Mouse, etc, maybe exist something better ?

2

There are 2 answers

2
choroba On BEST ANSWER

MOP is very low level, Moxie is based on it; but it's still a proof of concept.

There are faster and lighter alternatives that have been tested in production: Moo and Mouse.

0
GMB On

In which context do you use Moose and find it slow ? There is of course an overhead involved, but most of it happens at startup time (compilation) ; then, at runtime, most features are cheap (as long as you make your classes immutable), as explained in the documentation. Over the time Moose has become the de facto standard for object oriented programming and it has a very, very wide ecosystem (a search on MooseX on metacpan returns 820 results). Don't give up on it to early.

If you really need faster startup time (like in vanilla CGI environment for example), the most relevant alternative to Moose is Moo, Minimal Object Orientation. It is really light-weithg, has no XS dependency, while implementing a significant subset of Moose (also, its syntax is fully compatible with Moose so you upgrade to Moose anytime later if you need some piece of functionality that you find missing in Moo). It also has a rich ecosystem.