Class::...structor(3)
π Class::MOP::Method::Constructor π
okay bestie, so this page is Class::MOP::Method::Constructor from the User Contributed Perl Documentation corner of the perl man pages, and it's literally the method meta object that builds your constructors β¨ no cap
πΈ NAME πΈ
Class::MOP::Method::Constructor β Method Meta Object for constructors π
like. it's the meta object. for constructors. that's the whole vibe.
π VERSION π
version 2.4000 β yeah she's on 2.4000, keep up π«Ά
β¨ SYNOPSIS β¨
here's how you actually use her, copy-paste style:
use Class::MOP::Method::Constructor;
my $constructor = Class::MOP::Method::Constructor->new(
metaclass => $metaclass,
options => {
debug => 1, # this is all for now
},
);
# calling the constructor ...
$constructor->body->execute($metaclass->name, %params);
yes the debug => 1 comment literally says "this is all for now" and honestly? iconic. lowkey relatable. she's doing her best π₯Ί
π DESCRIPTION π
okay so Class::MOP::Method::Constructor is a subclass of Class::MOP::Method, and what she does β her whole main character thing β is generate constructor methods. that's it. that's the job. and she eats every time π
π₯
π METHODS π
π Class::MOP::Method::Constructor->new(%options)
this is the glow-up moment: she creates a brand new constructor object. hand her a hash reference of options and she's good to go β¨
here's the tea on those options:
metaclassβ this one should be aClass::MOP::Classobject. and it's required, bestie, no skipping it πnameβ the method name, and without a package name (just the name, ok?). also required πpackage_nameβ the package name for the method. yep. required too π«Άis_inlineβ this tells her whether or not the constructor should be inlined. it defaults to false, so if you don't say anything she's not inlining, periodt.
π $metamethod->is_inline
returns a boolean that says whether or not the constructor is inlined. true or false, that's the whole answer, no essay required π
π¦ $metamethod->associated_metaclass
this one hands you back the Class::MOP::Class object for the method. like, the metaclass that's associated. hence the name. slay π
π AUTHORS π
look at this roster, it's giving collaborative masterpiece, the way so many people poured into this ππ
- 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>
ten whole legends. we stan every single one π«Άπ
π COPYRIGHT AND LICENSE π
so, legal bit but make it cute:
This software is copyright (c) 2006 by Infinity Interactive, Inc.
and the license tea:
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
tl;dr: free software, same terms as perl 5 itself, go wild (responsibly) π
and that's the whole page, bestie!! this was Class::...structor(3) πβ¨ from perl v5.42.0, dated 2025-07-25 β mwah, love that for us, bye!! π
ππ¦
π¦ 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