1Object::Pad::MOP::FieldU(s3e)r Contributed Perl DocumentaOtbijoenct::Pad::MOP::Field(3)
2
3
4
6 "Object::Pad::MOP::Field" - meta-object representation of data field of
7 a "Object::Pad" class
8
10 Instances of this class represent a data field of a class implemented
11 by Object::Pad. Accessors provide information about the field. The
12 special "value" method allows access to the value of the given field on
13 instances of its class, letting the meta-object be used as a proxy to
14 it.
15
16 This API should be considered experimental even within the overall
17 context in which "Object::Pad" is expermental.
18
20 name
21 $name = $metafield->name
22
23 Returns the name of the field, as a plain string including the leading
24 sigil character.
25
26 sigil
27 $sigil = $metafield->sigil
28
29 Since version 0.56.
30
31 Returns the first character of the field name, giving just its leading
32 sigil.
33
34 class
35 $metaclass = $metafield->class
36
37 Returns the Object::Pad::MOP::Class instance representing the class of
38 which this field is a member.
39
40 value
41 $current = $metafield->value( $instance )
42 @current = $metafield->value( $instance )
43 %current = $metafield->value( $instance )
44
45 An accessor method which returns the current value of the field from an
46 object instance.
47
48 $metafield->value( $instance ) = $new
49
50 On scalar fields, this method can also act as an lvalue mutator
51 allowing a new value to be set.
52
53 has_attribute
54 $exists = $metafield->has_attribute( $name )
55
56 Since version 0.57.
57
58 Returns a boolean indicating whether the named attribute has been
59 attached to the field. The attribute name should not include the
60 leading colon (":") character.
61
62 get_attribute_value
63 $value = $metafield->get_attribute_value( $name )
64
65 Since version 0.57.
66
67 Returns the stored value of an attached attribute, if one exists. If
68 the attribute has not been attached then an exception is thrown.
69
70 Note that most core-defined attributes will either store no data at
71 all, or a method name string. This accessor method is provided largely
72 for the benefit of obtaining data defined by third-party attributes,
73 which may more clearly define how that data is generated and used.
74
76 Paul Evans <leonerd@leonerd.org.uk>
77
78
79
80perl v5.34.0 2022-03-02 Object::Pad::MOP::Field(3)