1metaclass(3) User Contributed Perl Documentation metaclass(3)
2
3
4
6 metaclass - a pragma for installing and using Class::MOP metaclasses
7
9 version 2.2014
10
12 package MyClass;
13
14 # use Class::MOP::Class
15 use metaclass;
16
17 # ... or use a custom metaclass
18 use metaclass 'MyMetaClass';
19
20 # ... or use a custom metaclass
21 # and custom attribute and method
22 # metaclasses
23 use metaclass 'MyMetaClass' => (
24 'attribute_metaclass' => 'MyAttributeMetaClass',
25 'method_metaclass' => 'MyMethodMetaClass',
26 );
27
28 # ... or just specify custom attribute
29 # and method classes, and Class::MOP::Class
30 # is the assumed metaclass
31 use metaclass (
32 'attribute_metaclass' => 'MyAttributeMetaClass',
33 'method_metaclass' => 'MyMethodMetaClass',
34 );
35
36 # if we'd rather not install a 'meta' method, we can do this
37 use metaclass meta_name => undef;
38 # or if we'd like it to have a different name,
39 use metaclass meta_name => 'my_meta';
40
42 This is a pragma to make it easier to use a specific metaclass and a
43 set of custom attribute and method metaclasses. It also installs a
44 "meta" method to your class as well, unless "undef" is passed to the
45 "meta_name" option.
46
47 Note that if you are using Moose, you most likely do not want to be
48 using this - look into Moose::Util::MetaRole instead.
49
51 • Stevan Little <stevan@cpan.org>
52
53 • Dave Rolsky <autarch@urth.org>
54
55 • Jesse Luehrs <doy@cpan.org>
56
57 • Shawn M Moore <sartak@cpan.org>
58
59 • יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
60
61 • Karen Etheridge <ether@cpan.org>
62
63 • Florian Ragwitz <rafl@debian.org>
64
65 • Hans Dieter Pearcey <hdp@cpan.org>
66
67 • Chris Prather <chris@prather.org>
68
69 • Matt S Trout <mstrout@cpan.org>
70
72 This software is copyright (c) 2006 by Infinity Interactive, Inc.
73
74 This is free software; you can redistribute it and/or modify it under
75 the same terms as the Perl 5 programming language system itself.
76
77
78
79perl v5.32.1 2021-01-27 metaclass(3)