table of contents
Object::Pad::MOP::Slot(3pm) | User Contributed Perl Documentation | Object::Pad::MOP::Slot(3pm) |
NAME¶
"Object::Pad::MOP::Slot" - meta-object representation of data slot of a "Object::Pad" class
DESCRIPTION¶
Instances of this class represent a data slot of a class implemented by Object::Pad. Accessors provide information about the slot. The special "value" method allows access to the value of the given slot on instances of its class, letting the meta-object be used as a proxy to it.
This API should be considered experimental even within the overall context in which "Object::Pad" is expermental.
METHODS¶
name¶
$name = $metaslot->name
Returns the name of the slot, as a plain string including the leading sigil character.
sigil¶
$sigil = $metaslot->sigil
Since version 0.56.
Returns the first character of the slot name, giving just its leading sigil.
class¶
$metaclass = $metaslot->class
Returns the Object::Pad::MOP::Class instance representing the class of which this slot is a member.
value¶
$current = $metaslot->value( $instance ) @current = $metaslot->value( $instance ) %current = $metaslot->value( $instance )
An accessor method which returns the current value of the slot from an object instance.
$metaslot->value( $instance ) = $new
On scalar slots, this method can also act as an lvalue mutator allowing a new value to be set.
has_attribute¶
$exists = $metaslot->has_attribute( $name )
Since version 0.57.
Returns a boolean indicating whether the named attribute has been attached to the slot. The attribute name should not include the leading colon (":") character.
get_attribute_value¶
$value = $metaslot->get_attribute_value( $name )
Since version 0.57.
Returns the stored value of an attached attribute, if one exists. If the attribute has not been attached then an exception is thrown.
Note that most core-defined attributes will either store no data at all, or a method name string. This accessor method is provided largely for the benefit of obtaining data defined by third-party attributes, which may more clearly define how that data is generated and used.
AUTHOR¶
Paul Evans <leonerd@leonerd.org.uk>
2021-12-16 | perl v5.32.1 |