13 Aug 2022 06:42:42 UTC
- Distribution: Object-Pad
- Module version: 0.68
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (24)
- Testers (556 / 54 / 3)
- KwaliteeBus factor: 1
- % Coverage
- License: perl_5
- Perl: v5.18.0
- Download (144.51KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:16 non-PAUSE users
Object::Pad::MOP::Field- meta-object representation of data field of a
Instances of this class represent a data field of a class implemented by Object::Pad. Accessors provide information about the field. The special
valuemethod allows access to the value of the given field on instances of its class, letting the meta-object be used as a proxy to it.
This API should be considered experimental, and will emit warnings to that effect. They can be silenced with
use Object::Pad qw( :experimental(mop) );
$name = $metafield->name
Returns the name of the field, as a plain string including the leading sigil character.
$sigil = $metafield->sigil
Since version 0.56.
Returns the first character of the field name, giving just its leading sigil.
$metaclass = $metafield->class
Returns the Object::Pad::MOP::Class instance representing the class of which this field is a member.
$current = $metafield->value( $instance ) @current = $metafield->value( $instance ) %current = $metafield->value( $instance )
An accessor method which returns the current value of the field from an object instance.
$metafield->value( $instance ) = $new
On scalar fields, this method can also act as an lvalue mutator allowing a new value to be set.
$exists = $metafield->has_attribute( $name )
Since version 0.57.
Returns a boolean indicating whether the named attribute has been attached to the field. The attribute name should not include the leading colon (
$value = $metafield->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.
@values = $metafield->get_attribute_values( $name )
Since version 0.66.
Returns all the stored values of an attached attribute, if one exists. If the attribute has not been attached then an exception is thrown.
This allows inspection of stored attribute values if it makes meaningful sense for the attribute to be applied multiple times to the same field. This is unlikely to be useful for core-defined attributes, but may be meaningful for third-party attributes.
Paul Evans <firstname.lastname@example.org>
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|