1Object::Pad::MOP::ClassU(s3e)r Contributed Perl DocumentaOtbijoenct::Pad::MOP::Class(3)
2
3
4

NAME

6       "Object::Pad::MOP::Class" - meta-object representation of a
7       "Object::Pad" class
8

DESCRIPTION

10       Instances of this class represent a class or role implemented by
11       Object::Pad. Accessors provide information about the class or role, and
12       methods that can alter the class, typically by adding new elements to
13       it, allow a program to extend existing classes.
14
15       Where possible, this API is designed to be compatible with MOP::Class.
16
17       This API should be considered experimental even within the overall
18       context in which "Object::Pad" is expermental.
19

METHODS

21   is_class
22   is_role
23          $bool = $metaclass->is_class
24          $bool = $metaclass->is_role
25
26       Exactly one of these methods will return true, depending on whether
27       this metaclass instance represents a true "class", or a "role".
28
29   name
30          $name = $metaclass->name
31
32       Returns the name of the class, as a plain string.
33
34   superclasses
35          @classes = $metaclass->superclasses
36
37       Returns a list of superclasses, as Object::Pad::MOP::Class instances.
38
39       Because "Object::Pad" does not support multiple superclasses, this list
40       will contain at most one item.
41
42   roles
43          @roles = $metaclass->roles
44
45       Returns a list of roles implemented by this class, as
46       Object::Pad::MOP::Class instances.
47
48   compose_role
49          $metaclass->compose_role( $rolename )
50          $metaclass->compose_role( $rolemeta )
51
52       Adds a new role to the list of those implemented by the class.
53
54       The new role can be specified either as a plain string giving its name,
55       or as an "Object::Pad::MOP::Class" meta instance directly.
56
57   add_BUILD
58          $metaclass->add_BUILD( $code )
59
60       Adds a new "BUILD" block to the class, as a CODE reference.
61
62   add_method
63          $metamethod = $metaclass->add_method( $name, $code )
64
65       Adds a new named method to the class under the given name, as CODE
66       reference.
67
68       Returns an instance of Object::Pad::MOP::Method to represent it.
69
70   get_own_method
71          $metamethod = $metaclass->get_own_method( $name )
72
73       Returns an instance of Object::Pad::MOP::Slot to represent the method
74       of the given name, if one exists. If not an exception is thrown.
75
76       This can only see directly-applied methods; that is, methods created by
77       the "method" keyword on the class itself, or added via "add_method".
78       This will not see other names in the package stash, even if they
79       contain a "CODE" slot, nor will it see methods inherited from a
80       superclass.
81
82   add_slot
83          $metaslot = $metaclass->add_slot( $name )
84
85       Adds a new slot to the class, using the given name (which must begin
86       with the sigil character "$", "@" or "%").
87
88       Returns an instance of Object::Pad::MOP::Slot to represent it.
89
90   get_slot
91          $metaslot = $metaclass->get_slot( $name )
92
93       Returns an instance of Object::Pad::MOP::Slot to represent the slot of
94       the given name, if one exists. If not an exception is thrown.
95

AUTHOR

97       Paul Evans <leonerd@leonerd.org.uk>
98
99
100
101perl v5.32.1                      2021-02-19        Object::Pad::MOP::Class(3)
Impressum