NAME
Moose::Meta::Attribute - The Moose attribute metaclass
DESCRIPTION
This is a subclass of Class::MOP::Attribute with Moose specific extensions.
For the most part, the only time you will ever encounter an instance of this class is if you are doing some serious deep introspection. To really understand this class, you need to refer to the Class::MOP::Attribute documentation.
METHODS
Overridden methods
These methods override methods in Class::MOP::Attribute and add Moose specific features. You can safely assume though that they will behave just as Class::MOP::Attribute does.
- new
- initialize_instance_slot
- install_accessors
- accessor_metaclass
- get_value
- set_value
Additional Moose features
Moose attributes support type-constraint checking, weak reference creation and type coercion.
- clone_and_inherit_options
-
This is to support the
has '+foo'
feature, it clones an attribute from a superclass and allows a very specific set of changes to be made to the attribute. - has_type_constraint
-
Returns true if this meta-attribute has a type constraint.
- type_constraint
-
A read-only accessor for this meta-attribute's type constraint. For more information on what you can do with this, see the documentation for Moose::Meta::TypeConstraint.
- has_handles
-
Returns true if this meta-attribute performs delegation.
- handles
-
This returns the value which was passed into the handles option.
- is_weak_ref
-
Returns true if this meta-attribute produces a weak reference.
- is_required
-
Returns true if this meta-attribute is required to have a value.
- is_lazy
-
Returns true if this meta-attribute should be initialized lazily.
NOTE: lazy attributes, must have a
default
field set. - should_coerce
-
Returns true if this meta-attribute should perform type coercion.
- should_auto_deref
-
Returns true if this meta-attribute should perform automatic auto-dereferencing.
NOTE: This can only be done for attributes whose type constraint is either ArrayRef or HashRef.
- has_trigger
-
Returns true if this meta-attribute has a trigger set.
- trigger
-
This is a CODE reference which will be executed every time the value of an attribute is assigned. The CODE ref will get two values, the invocant and the new value. This can be used to handle basic bi-directional relations.
- documentation
-
This is a string which contains the documentation for this attribute. It serves no direct purpose right now, but it might in the future in some kind of automated documentation system perhaps.
- has_documentation
-
Returns true if this meta-attribute has any documentation.
BUGS
All complex software has bugs lurking in it, and this module is no exception. If you find a bug please either email me, or add the bug to cpan-RT.
AUTHOR
Stevan Little <stevan@iinteractive.com>
Yuval Kogman <nothingmuch@woobling.com>
COPYRIGHT AND LICENSE
Copyright 2006, 2007 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.