Moose::Object(3)
π Moose::Object π β the base object for Moose, bestie
So like. This is the Moose::Object manual page, and I'm about to make it your whole personality. Grab a boba, we're doing inheritance. π§β¨
π VERSION π
version 2.4000 β that's the one, no cap.
πΈ DESCRIPTION πΈ
Okay so here's the tea: this class is the default base class for all Moose-using classes. The way it works is, when you use Moose in your class, your class inherits from this one. Periodt. π
It hands you a default constructor and destructor, and those lil guys run all the BUILD and DEMOLISH methods in the inheritance hierarchy, respectively. Like they literally go around collecting everybody's BUILD and DEMOLISH and running them in order. Iconic behaviour honestly. π«Ά
And now the part everyone asks: you do not actually need to inherit from this in order to use Moose. Nope! But it makes it so much easier to take advantage of all of Moose's features, so like... why wouldn't you. Lowkey a no-brainer. β¨
π METHODS π
π Moose::Object->new(%params|$params)
This method calls $class->BUILDARGS(@_), and then creates a new instance of the appropriate class. Once the instance is created, it calls $instance->BUILD($params) for each BUILD method in the inheritance hierarchy. It's giving "assembly line but make it cute". π¦
π Moose::Object->BUILDARGS(%params|$params)
The default implementation of this method accepts a hash or hash reference of named parameters. If it receives a single argument that isn't a hash reference β boom β it throws an error. Not me being strict, it's just how it is. π
You can override this method in your class to handle other types of options passed to the constructor. Go off, customise. π₯
Heads up bestie: this method should always return a hash reference of named options. Always. No exceptions. π
π $object->does($role_name)
This returns true if the object does the given role. Simple as that. Vibe check passed. β
π $object->DOES($class_or_role_name)
This is a Moose role-aware implementation of DOES in UNIVERSAL.
This is effectively the same as writing:
$object->does($name) || $object->isa($name)
This method will work with Perl 5.8, which did not implement UNIVERSAL::DOES. Old school Perl girlies stay winning. π
π $object->dump($maxdepth)
This is a handy utility for Data::Dumpering an object. By default, there is no maximum depth. It just keeps going. Obsessed with the commitment honestly. π
π $object->DESTROY
A default destructor is provided, which calls $instance->DEMOLISH($in_global_destruction) for each DEMOLISH method in the inheritance hierarchy. The reverse of the BUILD situation, and yes it's the full hierarchy, every single time. π
π BUGS π
See "BUGS" in Moose for details on reporting bugs. If something's broken, tell the Moose people, not me, I'm just the messenger. π
β¨ AUTHORS β¨
- Stevan Little <stevan@cpan.org>
- Dave Rolsky <autarch@urth.org>
- Jesse Luehrs <doy@cpan.org>
- Shawn M Moore <sartak@cpan.org>
- ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman) <nothingmuch@woobling.org>
- Karen Etheridge <ether@cpan.org>
- Florian Ragwitz <rafl@debian.org>
- Hans Dieter Pearcey <hdp@cpan.org>
- Chris Prather <chris@prather.org>
- Matt S Trout <mstrout@cpan.org>
Look at that list. A whole squad. The main characters of Moose. π
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2006 by Infinity Interactive, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Free is free, bestie, go wild. π
and that's the whole page!! π Brought to you by perl v5.42.0, dated 2025-07-25 β yes that's the version and the date from the very bottom, I saved them for you like a lil souvenir. π«Ά Byeee, go write some classes. πΈβ¨
π¦ where this page comes from
- fedora 43: perl-Moose 2.4000-4.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms