Moose and Perl OO
Learn about features provided by Moose.
We'll cover the following
The Moose module
Moose provides many features beyond Perl’s default OO system. Although we can build everything we get with Moose either by ourselves
Moose provides constructors, destructors, accessors, and encapsulation. We must do the work of declaring what we want, but we get safe and useful code in return. Moose objects can extend and work with objects from the vanilla Perl system.
While Moose is not a part of the Perl core, its popularity ensures that it’s available on many OS distributions. Perl distributions such as Strawberry Perl and ActivePerl also include it. Even though Moose is a CPAN module and not a core library, its cleanliness and simplicity make it essential to modern Perl programming.
Metaprogramming
Moose also allows metaprogramming—manipulating our objects through Moose itself. If you've ever wondered which methods are available on a class or an object or which attributes an object supports, this information is available:
Get hands-on with 1400+ tech skills courses.