The main benefits I see are

1. You have to write less code
2. Roles provide the benefits of multiple inheritance without the insanity
3. Introspection of Moose classes is easier
4. Type safety (which is really just points 1 and 3 again)

The biggest one is 1. Moose is basically a declarative language for
creating classes. It creates a lot of the code for you based on what you
say you want. Sure you could write that code, but it is all boilerplate
stuff and I would rather spend my time working logic than boilerplate. It
also provides nice abstract concepts like before, after, and around
methods. Sure, you could just use $self-SUPER::method(@_) at the right, but
the new keywords provide a more self documenting way of expressing the
relationship.

Sure, Moose can't do anything that Perl 5's OO can't do because Moose it's
written using Perl 5's OO, but, in the end, Moose is already written and
provides a lot of shortcuts (once you learn how to use it)

On Mon, Apr 24, 2017, 20:40 Peng Yonghua <p...@vodafonemail.de> wrote:

> Hi,
>
> I saw many modules begin to write with Moose.
>
> For me I wrote my perl modules most time with OO style, I think perl's
> native OO works just fine.
>
> So why needs moose? thanks.
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to