metaclass(3)

πŸ’– metaclass πŸ’–

okay bestie, gather round β€” this is the page for metaclass(3), and it lives in the User Contributed Perl Documentation section of your man pages. Yes we're reading a manpage for fun now. That's just who we are. πŸ’…


✨ NAME ✨

metaclass β€” it's a pragma for installing and using Class::MOP metaclasses πŸŽ€


🌸 VERSION 🌸

version 2.4000 (yes, that's the real number, no I'm not being cute)


πŸ¦‹ SYNOPSIS πŸ¦‹

package MyClass;

# use Class::MOP::Class
use metaclass;

# ... or use a custom metaclass
use metaclass 'MyMetaClass';

# ... or use a custom metaclass
# and custom attribute and method
# metaclasses
use metaclass 'MyMetaClass' => (
    'attribute_metaclass' => 'MyAttributeMetaClass',
    'method_metaclass'    => 'MyMethodMetaClass',
);

# ... or just specify custom attribute
# and method classes, and Class::MOP::Class
# is the assumed metaclass
use metaclass (
    'attribute_metaclass' => 'MyAttributeMetaClass',
    'method_metaclass'    => 'MyMethodMetaClass',
);

# if we'd rather not install a 'meta' method, we can do this
use metaclass meta_name => undef;
# or if we'd like it to have a different name,
use metaclass meta_name => 'my_meta';

look at all those options, she's versatile, she contains multitudes 😭✨


πŸ’œ DESCRIPTION πŸ’œ

So basically? This is a pragma whose whole job is making it easy to use one specific metaclass plus a whole little squad of custom attribute and method metaclasses. 🫢

And it also installs a "meta" method onto your class. Free of charge. Iconic behaviour honestly.

UNLESS β€” and this is the plot twist β€” you pass undef to the meta_name option. Then no meta method for you. πŸ™ˆ

⚠️ real talk bestie: if you're using Moose, you most likely do NOT want to be using this. Go look into Moose::Util::MetaRole instead. That's the one for you. πŸ’€

πŸ‘‘ AUTHORS πŸ‘‘

the literal legends who made this happen:

  • 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>

every single one of them, we stan 🌈


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. πŸ“


and that's the whole page, bestie β€” you ate that. mwah πŸ’‹

this has been metaclass(3) from perl v5.42.0, dated 2025-07-25 β€” catch you in the next manpage, love you, bye πŸ¦‹βœ¨

πŸ“¦ where this page comes from